How the Tester Works
Type a pattern, set your flags, paste a test string — every match appears instantly below, with its character position and the exact text it captured. The tester uses your browser's native JavaScript RegExp engine, so what matches here matches in Node.js and every modern browser, byte for byte. Everything runs locally; nothing is sent to a server.
Example: pattern \d+ with flag g against "Order 42 shipped in 3 days" returns two matches — [6] "42" and [18] "3". The number in brackets is the index where the match starts.
Regex Syntax Cheat Sheet
| Token | Matches | Example |
|---|---|---|
\d / \w / \s | digit / word char / whitespace | \d{4} → "2026" |
[a-z] | character range | [aeiou] → any vowel |
+ / * / ? | 1+, 0+, 0 or 1 repetitions | colou?r → "color", "colour" |
^ / $ | start / end of line (with m) | ^ERROR → lines starting with ERROR |
(…) | capture group | (\w+)@(\w+) |
a|b | alternation | cat|dog |
\. | literal dot (escaped) | 3\.14 |
Flags: Keep the g
The flags field accepts any combination of g (global — find all matches, not just the first), i (case-insensitive), m (multiline — ^/$ match per line), s (dot matches newlines) and u (Unicode). The tester lists all matches, which requires the g flag — if you remove it, you'll see zero results even for a valid pattern, so leave it in unless you're testing something else deliberately.
Common Pitfalls
- Greedy by default:
".*"on"a" and "b"matches the whole thing, quotes to quotes. Use the lazy form".*?"to stop at the first closing quote. - Unescaped metacharacters:
.,?,(,+have special meaning. Matching a literal price like "9.99" needs9\.99. - Invalid pattern = no matches: while you're mid-edit (e.g. an unclosed bracket), the tester simply shows zero matches instead of an error — keep typing.
Extracting URLs from your matches? Clean them up with the URL encoder, or validate JSON payloads first in the JSON formatter.