Regex Tester
Test and debug regular expressions with live matching
//
Preview
Enter test string...
Quick Reference
. Any character\d Digit [0-9]\w Word char\s Whitespace^ Start of string$ End of string* 0 or more+ 1 or more? Optional{n} Exactly n[abc] Character set(a|b) Group/OrAbout Regex Tester
How to Use the Regex Tester
- Enter your pattern - Type the regular expression
- Select flags - Choose matching behavior (global, case-insensitive, etc.)
- Enter test string - The text to match against
- Click Test - See matches highlighted in real-time
- Review results - View match details, positions, and groups
Regex Syntax Quick Reference
Character Classes
| Pattern | Matches |
|---|---|
. | Any character (except newline) |
\d | Digit [0-9] |
\D | Non-digit |
\w | Word character [a-zA-Z0-9_] |
\W | Non-word character |
\s | Whitespace |
\S | Non-whitespace |
[abc] | Any of a, b, or c |
[^abc] | Not a, b, or c |
[a-z] | Character range |
Quantifiers
| Pattern | Matches |
|---|---|
* | 0 or more |
+ | 1 or more |
? | 0 or 1 (optional) |
{3} | Exactly 3 |
{3,} | 3 or more |
{3,5} | Between 3 and 5 |
Anchors
| Pattern | Matches |
|---|---|
^ | Start of string/line |
$ | End of string/line |
\b | Word boundary |
\B | Non-word boundary |
Groups & References
| Pattern | Description |
|---|---|
(abc) | Capture group |
(?:abc) | Non-capture group |
(?<name>abc) | Named group |
\1 | Back-reference to group 1 |
| `a | b` |
Common Regex Patterns
Email Address
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
URL
https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)
Phone Number
\+?[0-9]{1,4}?[-.\s]?\(?[0-9]{1,3}?\)?[-.\s]?[0-9]{1,4}[-.\s]?[0-9]{1,4}[-.\s]?[0-9]{1,9}
IP Address
\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b
Date (YYYY-MM-DD)
\d{4}[-/]\d{2}[-/]\d{2}
Hex Color
#(?:[0-9a-fA-F]{3}){1,2}\b
Flags Explained
| Flag | Name | Description |
|---|---|---|
g | Global | Find all matches, not just the first |
i | Case-insensitive | Ignore case differences |
m | Multiline | ^ and $ match line boundaries |
s | Dotall | . matches newline characters |
u | Unicode | Enable full Unicode matching |
Related Tools
Code Minifier
Minify HTML, CSS, and JSON online. Reduce file size by removing comments, whitespace, and formatting. Free code compression tool.
Diff Checker
Compare two text versions side by side with highlights for additions and deletions. Spot changes in code, configs, or copy instantly with private, in-browser processing.
Hash Generator
Generate MD5, SHA-1, SHA-256, SHA-384, and SHA-512 hashes online. Free cryptographic hash calculator for developers.