Regex Tester
Test JavaScript regex patterns with live match highlighting, flags, capture groups, and replace mode. A fast browser-based regex checker for validating patterns before you ship them into code.
Regex testerJavaScript RegExpCapture groupsReplace mode
Flags
Regex cheatsheet
Character classes
- .
- any character except newline
- \d \D
- digit / non-digit
- \w \W
- word char (a-z A-Z 0-9 _) / non-word
- \s \S
- whitespace / non-whitespace
- [abc]
- any of a, b, c
- [^abc]
- none of a, b, c
- [a-z]
- character range
Anchors & boundaries
- ^ $
- start / end of string (or line with m)
- \b \B
- word boundary / non-boundary
Quantifiers
- * + ?
- 0+, 1+, or 0-1 of preceding
- {n} {n,} {n,m}
- exactly n, n+, between n and m
- *? +? ??
- lazy (smallest match)
Groups & references
- (abc)
- capture group
- (?:abc)
- non-capturing group
- (?<name>abc)
- named capture group
- \1 \2
- backreference to group 1, 2
- $1 $<name>
- in replacement string
Lookaround
- (?=abc)
- positive lookahead
- (?!abc)
- negative lookahead
- (?<=abc)
- positive lookbehind
- (?<!abc)
- negative lookbehind
Flags
- g
- global (find all matches)
- i
- case-insensitive
- m
- multiline (^/$ match line ends)
- s
- dotAll (. matches newlines)
- u
- unicode
- v
- unicode sets (extends u, allows nested classes)
- y
- sticky (match at lastIndex only)
How to use
- Enter your pattern. Any valid JavaScript regex.
- Pick flags. g, i, m, s, u, v, y as needed.
- Paste test string. Matches highlight live, with groups and replacements shown as needed.
Common use cases
- Building and debugging complex regex patterns
- Testing email or URL validators
- Extracting data from log files
Frequently asked questions
- Which regex engine does this use?
- It uses the browser native JavaScript RegExp engine (ECMAScript regex), so the syntax and behavior match what you see in Node.js and front-end JavaScript code.
- What regex flags are supported?
- All standard ECMAScript flags: g (global), i (case-insensitive), m (multiline), s (dotAll), u (unicode), v (unicode sets, the modern superset of u), and y (sticky).
- Can I use this for PCRE or POSIX regex?
- Not directly. JavaScript regex differs from PCRE in lookbehinds, named groups, and a few other features. Patterns written for PCRE may need light adjustment to run here.
- Does the page send my pattern or test string anywhere?
- No. The regex runs locally in your browser, so neither the pattern nor the test text leaves your device.
- How do replace mode and capture groups work?
- Toggle Replace mode to enter a replacement string. Use $1, $2, etc. to reference capture groups, or $<name> for named groups. The result updates live as you edit.
Related tools
How to use
- Enter your pattern. Any valid JavaScript regex.
- Pick flags. g, i, m, s, u, v, y as needed.
- Paste test string. Matches highlight live, with groups and replacements shown as needed.
Common use cases
- Building and debugging complex regex patterns
- Testing email or URL validators
- Extracting data from log files
Frequently asked questions
- Which regex engine does this use?
- It uses the browser native JavaScript RegExp engine (ECMAScript regex), so the syntax and behavior match what you see in Node.js and front-end JavaScript code.
- What regex flags are supported?
- All standard ECMAScript flags: g (global), i (case-insensitive), m (multiline), s (dotAll), u (unicode), v (unicode sets, the modern superset of u), and y (sticky).
- Can I use this for PCRE or POSIX regex?
- Not directly. JavaScript regex differs from PCRE in lookbehinds, named groups, and a few other features. Patterns written for PCRE may need light adjustment to run here.
- Does the page send my pattern or test string anywhere?
- No. The regex runs locally in your browser, so neither the pattern nor the test text leaves your device.
- How do replace mode and capture groups work?
- Toggle Replace mode to enter a replacement string. Use $1, $2, etc. to reference capture groups, or $<name> for named groups. The result updates live as you edit.