Regex Tester
Test, debug and visualize regular expressions with real-time matching
Invalid Pattern
Click a pattern to load it into the regex input
All regex testing happens entirely in your browser. No data is ever sent to any server. Your patterns and test strings stay completely private on your device.
What Are Regular Expressions?
The essential pattern-matching language used by developers worldwide
Regular expressions (regex) are sequences of characters that define search patterns. Originally developed in the 1950s by mathematician Stephen Kleene, regex has become an indispensable tool in software development. It is used for validating input (emails, phone numbers, URLs), extracting data from text, performing search-and-replace operations, and parsing log files and structured data.
Every modern programming language — JavaScript, Python, Java, PHP, Ruby, Go, C#, and more — provides built-in support for regular expressions. While the core syntax is largely shared, each language may have minor variations in supported features like lookbehinds, named groups, or Unicode properties.
Pattern Matching
Find specific text patterns in strings, from simple character sequences to complex nested structures with quantifiers, alternation, and lookaheads.
Input Validation
Validate user input like email addresses, phone numbers, URLs, credit card numbers, and custom formats with precise pattern rules.
Search & Replace
Transform text by replacing matched patterns with new strings, using capture groups to rearrange, reformat, or restructure data programmatically.
Common Regex Patterns
Ready-to-use patterns for everyday validation and extraction tasks
| Pattern | Description | Example Match |
|---|---|---|
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,} |
Email address | user@example.com |
https?:\/\/[^\s/$.?#].[^\s]* |
URL | https://example.com/path |
\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4} |
US phone number | (555) 123-4567 |
\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b |
IPv4 address | 192.168.1.1 |
\d{4}[-/]\d{2}[-/]\d{2} |
Date (YYYY-MM-DD) | 2025-03-15 |
#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3}) |
Hex color code | #ff6600 |
^[a-zA-Z0-9_-]{3,16}$ |
Username (3-16 chars) | john_doe42 |
(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,} |
Strong password | MyPass1word |
How to Use This Regex Tester
Follow these simple steps to test and debug your regular expressions
Enter Pattern
Type your regular expression in the pattern input field. You can also click a quick reference pattern to get started.
Set Flags
Toggle the regex flags (g, i, m, s, u) to control matching behavior like case sensitivity, multiline mode, and global matching.
Add Test String
Paste or type the text you want to match against. Matches are highlighted instantly as you type in real time.
Review & Replace
See all matches with their positions and capture groups. Use the replace section to test substitution patterns with $1, $2, etc.
Frequently Asked Questions
Everything you need to know about regular expressions and this regex tester
^ and $ match line beginnings and endings; s (dotAll) makes . match newline characters; and u (unicode) enables full Unicode matching and proper surrogate pair handling.(). When a match is found, each group captures the substring that matched its portion of the pattern. Groups are numbered starting at 1 and can be referenced in replacement strings using $1, $2, etc. Named groups use the syntax (?<name>...) and can be referenced with $<name>.++) or atomic groups. For JavaScript, TypeScript, and Node.js projects, this tool provides exact results.*, +, and ? are greedy — they match as many characters as possible. Adding a ? after them (e.g., *?, +?, ??) makes them lazy, matching as few characters as possible. For example, given the string <b>bold</b>, the pattern <.*> greedily matches the entire string, while <.*?> lazily matches only <b>.