Test regular expressions online
0 matches
Write a pattern, set flags, and test it against sample text — every match is listed with its position and capture groups, updating as you type. Everything runs in your browser using JavaScript's native RegExp engine; nothing you paste is sent anywhere.
Test against realistic input
The most common regex mistake is writing a pattern that works on the one clean example you had in mind and fails on real data. Paste in genuine samples including the awkward ones — empty values, unusual spacing, entries with unexpected punctuation. A pattern that matches your happy path and silently misses a tenth of your records is worse than one that obviously fails, because you may not notice.
Flags change the behaviour substantially
The g flag finds all matches rather than stopping at the first, i makes matching case-insensitive, and m changes ^ and $ to match at line boundaries rather than only at the start and end of the whole string. The s flag lets the dot match newlines, which it otherwise does not — a frequent source of confusion when a pattern that works on one line fails across several.
Catastrophic backtracking
Certain patterns, particularly nested quantifiers like (a+)+ applied to non-matching input, can take exponentially long to fail. This tool caps results at 1,000 matches to avoid runaway loops, but a genuinely pathological pattern can still hang the page briefly. That is a property of backtracking regex engines in general rather than this tool specifically, and it is worth knowing before deploying a complex pattern against untrusted input in production.
Frequently asked questions
- What flags are supported?
- Any valid JavaScript RegExp flags — g (global), i (case-insensitive), m (multiline), s (dot-all), u (unicode), and y (sticky).
- What happens if my pattern is invalid?
- You'll see the JavaScript engine's own syntax error message instead of a silent failure.
- Can a bad pattern freeze the page?
- Matching is capped at 1,000 results to avoid runaway loops, but extremely inefficient patterns (catastrophic backtracking) can still be slow — this is a limitation of regex engines generally, not specific to this tool.
- Is my text sent anywhere?
- No, matching happens locally in your browser. Nothing is transmitted.
- Why does my dot not match across lines?
- By default the dot excludes newlines. Add the s flag to make it match any character including line breaks.
- Which regex flavour is this?
- JavaScript's built-in engine. Most syntax is shared with other languages, but lookbehind support and some named-group syntax differ from PCRE.