Regex Tester
Pattern
JavaScript pattern only (no surrounding slashes). Updates in real time.
Text
Matches below will highlight instantly as you type.
Options
Flag: g
Global search โ find all matches, not just the first.
Flag: i
Ignore case โ case-insensitive matching (A = a).
Flag: m
Multiline โ ^ and $ match line starts/ends, not just the whole string.
Flag: s
DotAll โ make . match newline characters as well.
Flag: u
Unicode โ enable full Unicode mode; recommended for modern text.
Flag: y
Sticky โ match must start exactly at lastIndex (useful for incremental scans).
Flag: d
Indices โ expose start/end indices for the full match and capture groups (browser-dependent).
About the Regex Tester
Live-test JavaScript regular expressions in your browser. As you type, matches are highlighted below and a detailed text report is generated for copying or sharing.
Quick Regex Guide
- Literals & escaping: most characters match themselves. Use backslash to escape (e.g.
\.for a literal dot). - Common classes:
\ddigits,\wword chars,\swhitespace. Uppercase negates:\D,\W,\S. - Anchors:
^start,$end; withmthey apply per line. - Quantifiers:
a*0+,a+1+,a?0/1,a{2,5}range. Add?to make non-greedy:+?,*?. - Groups:
(...)capture;(?:...)non-capture; named capture(?<name>...). - Alternation:
a|bmatches either side. - Lookarounds:
(?=...)ahead,(?!...)neg-ahead,(?<=...)behind,(?<!...)neg-behind. - Flags:
gall matches,iignore case,mmultiline,sdotAll,uUnicode,ysticky,dindices.
Examples
- Email (simple):
\b(\w+)@([\w.-]+)\.(\w+)\b - ISO date:
\b(\d{4})-(\d{2})-(\d{2})\b - Price:
\$\d+(?:\.\d{2})?
Tips
- Prefer
uflag for modern text handling. - Use non-capturing groups
(?: )when you donโt need captured values. - Beware of catastrophic backtracking with nested, ambiguous quantifiers.