Regex Tester
Write a regular expression and see every match highlighted as you type, with capture groups listed and a live replace preview.
Matches highlighted
Match details
| # | Index | Match | Groups |
|---|
Replace
Cheat sheet
- \d
- digit
- \w
- word char
- \s
- whitespace
- .
- any char
- ^ $
- line start / end
- \b
- word boundary
- [abc]
- one of
- [^abc]
- none of
- a?
- 0 or 1
- a*
- 0 or more
- a+
- 1 or more
- a{2,4}
- 2 to 4
- (…)
- capture group
- (?<name>…)
- named group
- (?:…)
- no capture
- a|b
- a or b
- (?=…)
- lookahead
- (?<=…)
- lookbehind
How to test a regular expression
Type your pattern between the slashes and tick the flags you need. Every match in the test text is highlighted, and the table lists each match’s position and capture groups. Add a replacement to preview the result of a search and replace.
Patterns run in a background thread with a one-second limit, so a runaway pattern can’t freeze your browser.
Frequently asked questions
Which regex flavor is this?
JavaScript (ECMAScript), as used in browsers and Node.js. It supports lookbehind, named groups (?<name>…) and Unicode property escapes like \p{L} with the u flag.
What do the flags do?
g finds all matches, i ignores case, m makes ^ and $ match at line breaks, s lets . match line breaks, u enables full Unicode, and y matches only at the current position.
Why did my pattern time out?
Some patterns, such as (a+)+$, take exponentially long on certain text. The tester runs in a background thread and stops after one second so the page never freezes. Rewrite nested quantifiers to fix it.