Regex Tester
Test and debug regular expressions with real-time matching
Flags
Common Patterns
Regex Quick Reference
Character Classes
.
- Any character except newline\d
- Digit (0-9)\D
- Not a digit\w
- Word character (a-z, A-Z, 0-9, _)\W
- Not a word character\s
- Whitespace\S
- Not whitespace[abc]
- Any of a, b, or c[^abc]
- Not a, b, or c[a-z]
- Character range
Anchors
^
- Start of string/line$
- End of string/line\b
- Word boundary\B
- Not word boundary
Quantifiers
*
- 0 or more+
- 1 or more?
- 0 or 1{n}
- Exactly n{n,}
- n or more{n,m}
- Between n and m
Groups & Lookarounds
(abc)
- Capturing group(?:abc)
- Non-capturing group(?=abc)
- Positive lookahead(?!abc)
- Negative lookahead(?<=abc)
- Positive lookbehind(?<!abc)
- Negative lookbehind
Flags
g
- Global (find all matches)i
- Case insensitivem
- Multiline modes
- Dot matches newlineu
- Unicode modey
- Sticky mode
How to Use
- 1
Enter your regex pattern
Type your regular expression in the pattern field. The tool validates syntax in real-time and shows errors immediately.
- 2
Configure regex flags
Select appropriate flags: global (g) for all matches, case-insensitive (i), multiline (m), dotAll (s), unicode (u), or sticky (y).
- 3
Input test text
Paste or type the text you want to test against. The tool highlights all matches as you type with yellow background.
- 4
Analyze match results
View detailed match information including position, captured groups, and match count. Copy individual matches or the complete regex.
Frequently Asked Questions
What are regex flags and when should I use them?
What are regex flags and when should I use them?
Regex flags modify pattern matching behavior. Global (g) finds all matches instead of just the first. Case-insensitive (i) ignores letter case. Multiline (m) makes ^ and $ match line boundaries. DotAll (s) makes . match newlines. Unicode (u) enables full Unicode support. Sticky (y) matches from the last index position.
How do capturing groups work in regex?
How do capturing groups work in regex?
Parentheses create capturing groups that extract parts of matches. For example, (\d{3})-(\d{4}) captures area code and number separately in phone numbers. Use (?:...) for non-capturing groups when you need grouping without extraction. Access captured groups in results as Group 1, Group 2, etc.
What's the difference between greedy and lazy quantifiers?
What's the difference between greedy and lazy quantifiers?
Greedy quantifiers (*, +, ?, {n,m}) match as much as possible, while lazy quantifiers (*?, +?, ??, {n,m}?) match as little as possible. For example, .* in "<tag>content</tag>" matches the entire string, while .*? matches just "<tag>". Use lazy quantifiers to prevent over-matching.
How do I match special characters literally?
How do I match special characters literally?
Escape special regex characters with a backslash: \. \* \+ \? \[ \] \{ \} \( \) \| \^ \$ \\. Alternatively, use \Q...\E to quote a literal string. For example, \Q[price]\E matches "[price]" literally without treating brackets as a character class.