Regex Tester
Test regular expressions in your browser. Highlights matches and capture groups instantly.
About this tool
A regular expression is a pattern notation for finding a "shape" inside text. This tool applies your pattern to the target text, highlights the matches instantly, and shows the contents of capture groups. Everything, including execution, runs in your browser, so your input is never sent anywhere.
The basic symbols
- . is any single character / \d a digit / \w a word character / \s whitespace.
- * is zero or more / + one or more / ? zero or one / {2,5} a count range.
- [abc] is one of these / ^ start of line / $ end of line / \b a word boundary / ( ) grouping and capture.
Greedy vs lazy
By default, * and + (as in a.*b) match "as much as possible" (greedy). Applying <.*> to <a><b> makes the whole thing a single match. To stop at the shortest, add ? after * or +, giving .*? (lazy). With <.*?> you can capture <a> and <b> separately. When extraction misbehaves, this is the first thing to check.
Key flags
- g finds every match / i ignores case.
- m makes ^ and $ match the start and end of each line / s lets . match newlines too.
- u enables Unicode mode (handles emoji and \p{...} correctly).
Beware "catastrophic backtracking" (ReDoS)
Patterns with nested repetition like (a+)+$ can explode in the number of attempts when given input that fails to match, freezing the process (a slowdown/hang known as ReDoS). This is especially dangerous in services that run regexes on external input, so avoid nesting repetition. This tool caps the match count to prevent runaway processing.
How to use
- Enter a regular expression and toggle flags (i/m/s/u) as needed.
- Type the test text and matches are highlighted.
FAQ
Which regex engine does it use?
It runs on the browser's built-in JavaScript regular expression engine, so the actual match results are always JavaScript's. Differences from other languages are pointed out separately as a compatibility check.
Which flags are supported?
Standard flags such as g (global), i (case-insensitive), and m (multiline). To list every match, it treats the search as global internally.
Can I inspect the contents of capture groups?
Yes. In addition to highlighting match positions, it shows the contents of the capture groups pulled out by parentheses, which helps validate extraction rules.
Can it show differences from other languages (Python, Go, PCRE)?
Yes. Execution is on the JavaScript engine, but it flags things to watch for when moving a pattern to a chosen flavor — named-group syntax, unsupported backreferences or lookbehind, differences in how \d is handled, and more — helping prevent porting mistakes.
Are the pattern and text I enter sent to a server?
No. Everything runs in your browser, and neither the pattern nor the target text is sent externally, so it is safe to test against logs or text containing personal information.
What happens with a huge number of matches?
To prevent runaway processing, the match count is capped and extremely large numbers of matches are cut off partway. Narrowing the target or making the pattern more specific makes it easier to work with.