The Regex Tester runs JavaScript regular expressions against your sample text live in the browser: it lists every match with its position and any capture groups, includes a preset library for common patterns (email, URL, date, hex colour, integers, capitalised words, fixed-length words), and caps the display at 100 matches while still reporting the true total. It is the fastest way to debug a pattern before it ships.
How It Works
Your pattern is compiled with the JavaScript RegExp engine using the flags you set (global by default). With the global flag, all matches are collected with their start indices and the contents of each capture group; without it, only the first match is reported. Invalid patterns and invalid flags return the engine's own error message rather than failing silently, because the exact syntax complaint is the debugging information you came for. Matches beyond the first hundred are counted but not listed, which keeps a pattern like \d against a huge document from freezing the page.
Flags that change everything
| Flag | Name | Effect | |---|---|---| | g | Global | Find all matches, not just the first | | i | Case-insensitive | Letters match either case | | m | Multiline | ^ and $ match at line boundaries as well as string boundaries | | s | Dotall | The dot also matches line breaks | | u | Unicode | Full Unicode matching and \u{...} escapes | | y | Sticky | Matches must begin exactly at the last index |
Worked example
Against the text "Order 2026-10-23 ships 2026-11-02", the preset date pattern \d{4}-\d{2}-\d{2} finds two matches, at indices 6 and 24. Add capture groups, (\d{4})-(\d{2})-(\d{2}), and each match additionally reports its three groups (2026, 10, 23), which is how extraction differs from mere matching: validation wants the whole match, extraction wants the groups. A pattern for five-letter words, \b\w{5}\b, against "the quick brown fox jumps" finds quick, brown, and jumps, the word boundaries doing the work of excluding the shorter and longer words.
Reading a pattern like a professional
Build in layers and test each: anchors first (^ and $ pin the match to the string or, with m, the line), then the character classes (bracket sets, \d \w \s and their negations), then quantifiers, remembering that quantifiers are greedy by default and a trailing question mark makes them lazy (\d+? takes as few digits as possible). Groups capture for extraction, (?:...) groups without capturing when you only need the grouping. Alternation with the pipe is the weakest-binding operator, so wrap alternatives in a group when in doubt. The tester's index display exposes the most common silent bug: a pattern that matches, but starts one character earlier or later than intended because of a missing boundary.
The two dangers
Catastrophic backtracking: nested quantifiers over overlapping classes (the classic (a+)+$ family) can take exponential time on near-miss inputs, hanging the page or, in production, a server thread. The match cap here limits display, not matching time, so test adversarial near-miss strings, not just happy samples. The second danger is false confidence: a pattern that passes your samples has only been shown to accept them. Keep a set of must-not-match strings (for the email preset: missing domain suffixes, spaces, double at signs) and run both sets after every edit. Finally, remember engines differ: this is JavaScript flavour, no lookbehind restrictions aside, possessive quantifiers and atomic groups do not exist here, and a pattern tuned in a PCRE tool may not port unchanged.
Limitations
The tester evaluates with the browser's JavaScript engine against the text you paste. It cannot test streaming input, file-scale data, or other engines' dialects (PCRE, RE2, Python) beyond their shared core, and it offers no protection against a pattern you design to be slow other than your own testing discipline. Matches are literal engine results; whether a matched string is a valid email, date, or URL in the real-world sense still requires semantic checks a regex cannot perform (February 30 matches the date pattern beautifully).
Frequently Asked Questions
Why does my pattern match only the first occurrence?
The global flag is off. Enable g to collect every match; the tester defaults to global for exactly this reason, and its absence is the most common first-time confusion.
How do I match a literal dot or dollar sign?
Escape them: . and $. Unescaped, the dot means any character and the dollar is an end anchor, so a price pattern like $\d+.\d{2} needs both escapes to mean what it says.
Why did the tester stop listing matches at 100?
Display is capped at 100 to protect the page; the total count shown is the true number. If you need to inspect beyond the cap, narrow the pattern or split the sample text.