Regex Tester & Debugger
Master regular expressions with real-time testing, detailed explanations, and a comprehensive pattern library
Regex Pattern
Global (g)
Case-insensitive (i)
Multiline (m)
Dotall (s)
Unicode (u)
Test String Preview
Match Results
Replace Preview
Regex Debugger
Character Classes
| Pattern | Description | Example |
|---|---|---|
| . | Any character except newline | a.c matches "abc", "adc" |
| \d | Digit (0-9) | \d+ matches "123" |
| \w | Word character (a-z, A-Z, 0-9, _) | \w+ matches "hello_123" |
| \s | Whitespace (space, tab, newline) | \s+ matches spaces |
| [abc] | Character set | [abc] matches "a", "b", or "c" |
| [^abc] | Negated character set | [^abc] matches any char except a,b,c |
Quantifiers
| Pattern | Description | Example |
|---|---|---|
| * | 0 or more (greedy) | ab*c matches "ac", "abc", "abbc" |
| + | 1 or more (greedy) | ab+c matches "abc", "abbc" |
| ? | 0 or 1 (greedy) | ab?c matches "ac", "abc" |
| {n} | Exactly n times | a{3} matches "aaa" |
| {n,m} | Between n and m times | a{2,4} matches "aa", "aaa", "aaaa" |
| *? +? ?? {n,m}? | Lazy versions | ab*?c matches "ac", "abc" (shortest match) |
Anchors & Boundaries
| Pattern | Description | Example |
|---|---|---|
| ^ | Start of string/line | ^hello matches "hello world" |
| $ | End of string/line | world$ matches "hello world" |
| \b | Word boundary | \bword\b matches "word" as whole word |
| \B | Non-word boundary | \Bond\B matches "mond" in "mond" |
Groups & Lookarounds
| Pattern | Description | Example |
|---|---|---|
| (abc) | Capture group | (abc)+ captures "abc" |
| (?:abc) | Non-capturing group | (?:abc)+ doesn't capture |
| (?=abc) | Positive lookahead | \w+(?=ing) matches "walk" in "walking" |
| (?!abc) | Negative lookahead | \w+(?!ing) matches "walk" in "walk" |
| (?<=abc) | Positive lookbehind | (?<=re)start matches "start" in "restart" |
| (? | Negative lookbehind | (? |
Escape Sequences
| Sequence | Description |
|---|---|
| \\ | Backslash |
| \/ | Forward slash |
| \n | Newline |
| \t | Tab |
| \r | Carriage return |
| \0 | Null character |
Pre-built Pattern Library
Click "Test" to load a pattern into the Regex Tester. Click "Copy" to copy to clipboard.