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
Key facts
- Privacy
- Runs in your browser: your files and text are never uploaded
- Last updated
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.
Sources
The rules and figures this tool uses come from:
Related tools
- JSON FormatterPretty-print, validate and minify JSON
- Unix Timestamp ConverterEpoch time to dates and back
- Binary ConverterBinary, decimal, hex and octal, two’s complement and text to binary
- Base64 Encode / DecodeText and files to and from Base64
- URL Encode / DecodePercent-encode text and inspect URLs
- Hash GeneratorMD5, SHA-1, SHA-256 and SHA-512 for text and files
- JWT DecoderInspect header, payload, expiry and signature
- Bottleneck CalculatorCheck if your CPU or GPU holds back gaming performance