Regex Tester
Build and test regular expressions with live highlighting and capture groups, using your browser's own regex engine. Everything runs locally.
New to this? Read the Regex Tester guide →
Highlighted matches
Matches
How to use the regex tester
- Type your pattern, then paste the text you want to search.
- Toggle the flags you need. Matches and capture groups are highlighted live as you edit, so you can shape the pattern by trial and error.
- When it matches what you expect, copy the pattern into your code.
The flags
- g — find every match, not just the first.
- i — case-insensitive.
- m — multiline, so ^ and $ match at each line.
- s — dotall, so . also matches newlines.
The building blocks
Most patterns are made from a handful of pieces: anchors (^ $), character classes (\d \w \s and [...]), quantifiers (* + ? {n,m}), groups ((...) and non-capturing (?:...)), and alternation (a|b). Quantifiers are greedy by default; add ? to make them lazy when a pattern is grabbing too much.
Watch out for
- Escaping. To match a literal metacharacter such as a dot, escape it: \..
- Catastrophic backtracking. Nested quantifiers over overlapping patterns (like (a+)+$) can hang on a long near-match. Test with awkward input.
For a task-oriented set of patterns you can paste straight in (email, URL, date, slug) plus the gotchas, see a practical regex cheat sheet.
Where you'd use this
Building a pattern before it goes anywhere near production: a log parser, a form validation rule, a find-and-replace across a codebase, a redirect rule in nginx.
For example: You need to pull order IDs from support emails. Testing #(\d{6,8}) against twenty real messages shows it also matches invoice numbers — adding ORD- to the pattern fixes it before it silently corrupts a report.
Frequently asked questions
How do I test a regular expression?
Enter your pattern and some sample text; matches are highlighted live as you type, so you can refine the expression until it captures exactly what you want.
Which regex flavour does it use?
It uses JavaScript’s regular-expression engine — the same one in browsers and Node.js — including flags like global, case-insensitive and multiline.
Is my text or pattern uploaded?
No. Matching happens entirely in your browser.