How it works
The tester compiles your pattern with the browser's JavaScript RegExp engine and runs it against the test string on every keystroke. Matches are highlighted in place, and the details panel lists each match with its index and capture groups, so you can see exactly what a pattern captures before shipping it in code.
Flags are editable independently of the pattern. g finds every match instead of stopping at the first, i makes matching case-insensitive, m changes ^ and $ to match line boundaries, and s lets the dot match newlines. Watching the highlight change as you toggle flags is the fastest way to understand what each one really does.
Invalid patterns fail loudly: a syntax error badge shows the engine's message instead of a silent empty result. An empty pattern is treated as “waiting for input” rather than matching everything, which avoids the classic trap of an empty regex matching at every position.
The quick reference panel covers the everyday tokens — character classes, quantifiers, groups, alternation and lookahead — so the page works as a cheat sheet while you iterate. JavaScript regex syntax is close to PCRE for common patterns, but edge cases such as lookbehind, named groups and Unicode flags differ between engines; always re-test patterns in the runtime that will execute them.
Worked example
Test the pattern \b\w+@\w+\.\w+\b with flags gi against a two-line support message. The engine scans the string and records every email-shaped match.
| Match | Index | What the engine saw |
|---|---|---|
hello@toolplex.net | 0 | Word boundary, one or more word chars, @, domain, dot, TLD. |
support@toolplex.net | 26 | Same structure; g keeps searching after the first hit. |
john.doe@example.com | next line | The dot inside the local part is matched by \w+? No — it is matched literally by the @\w+\.\w+ portion. |
- Write the pattern: Type the expression between the slashes and set the flags you need.
- Paste a test string: Use realistic input, including edge cases that should not match.
- Read the highlight: Matches light up in place; the details panel lists indexes and groups.
- Iterate on flags: Toggle g, i, m and s to see their effect before copying the pattern into code.
Removing g leaves only the first match highlighted; adding m would change nothing here because the pattern has no anchors. Swapping \w+ for [\w.+-]+ in the local part is the standard fix for addresses such as john.doe.
Common errors and edge cases
- Catastrophic backtracking. Nested quantifiers such as
(a+)+$can freeze the tab on long non-matching input. Rewrite with atomic structure or bounded classes. - Escaped vs literal backslash. In the pattern field you type
\ddirectly; in JavaScript source the same pattern needs"\\d". A pattern that works here but not in code is usually double-escaping. - Multiline anchors.
^ERRORonly matches at string start without themflag, even when the log has many lines. - The dot and newlines.
.stops at line breaks unless thes(dotAll) flag is set. - Greedy vs lazy.
<.+>swallows everything between the first and last tag;<.+?>stops at the first closing bracket.
Code equivalents
The same test runs in any language; only the API shape changes. These snippets mirror what the page does in your browser.
| Language | Example |
|---|---|
| JavaScript | const re = /\b\w+@\w+\.\w+\b/gi; const matches = [...text.matchAll(re)]; |
| Python 3 | re.findall(r'\b\w+@\w+\.\w+\b', text, flags=re.IGNORECASE) returns every match as a list. |
| PHP (PCRE) | preg_match_all('/\b\w+@\w+\.\w+\b/i', $text, $m); fills $m with matches and groups. |
Related tools
Frequently asked questions
Which regex engine does this tester use?
The browser's JavaScript engine. Common syntax is shared with PCRE and Python, but lookbehind support, named group syntax and Unicode flags differ — always re-test in your production runtime.
Why does my pattern work here but throw in Python?
JavaScript-specific constructs such as unescaped ] inside a class, or different named-group syntax, are not portable. Check the target engine's documentation for the exact feature.
How do I match across multiple lines?
Enable the s flag so the dot matches newlines, and use m when ^ and $ should match at line boundaries instead of only the string edges.
What are capture groups good for?
Parentheses record the matched sub-part, which the details panel lists per match. Use (?:...) for grouping without capturing when you only need alternation or quantifiers.
Can a regex freeze my browser?
Yes — nested quantifiers over long, almost-matching input cause exponential backtracking. If the tab hangs, simplify the pattern and bound repetitions.
Privacy note
All processing happens in your browser. The values you enter never leave your device and are never transmitted to ToolPlex.