Regex Tester
Test a JavaScript regular expression and inspect every match. Your work stays on this device whenever possible.
How to use Regex Tester
- Choose a starter in "Preset Patterns" (email, HTTP / HTTPS URL, IPv4, ISO 8601 date, UUID v4, hex colour, HTML tags, phone or URL slug), or type your own pattern between the two slashes.
- Toggle the flag boxes g, i, m, s and u; the preloaded email pattern starts with g and i ticked.
- Edit "Test String" and watch the count beside it, for example "4 matches", and the yellow "Highlighted Matches Preview" update on each keystroke.
- Under "Substitution / Replace Mode", type a replacement such as [$1 at $2] to preview substituted text, then press "Copy Replaced".
- Pick JavaScript, Python (re), Go (regexp) or PHP (preg_match_all) in "Export Code Snippets" to see starter code for the current pattern.
Worked example
With the preloaded email pattern and two-line sample text, the counter reads 4 matches: support@toolkitpoint.com, security@toolkitpoint.com, info@my-domain.co.uk and admin123@sub.domain.org. Group 1 of the first is support and Group 2 is toolkitpoint.com. Entering [$1 at $2] as the replacement turns the first address into [support at toolkitpoint.com] in the substitution box.
When to use this tool
- Debugging a validation pattern against real sample lines before putting it in a form.
- Previewing a search-and-replace with capture groups before running it across files.
- Copying a working pattern as ready-made Python or Go starter code.
Important limitations
JavaScript regular expressions execute locally in your browser. Catastrophic backtracking patterns (such as nested quantifiers `(a+)+$`) can cause browser thread delays.
Frequently asked questions
Which regex flavour does it use?
The JavaScript engine of your own browser, so lookbehind, named groups and Unicode property escapes work only as far as that browser supports them. Python, Go and PHP differ, for instance in named-group syntax, so re-test in the target language.
Is there protection against catastrophic backtracking?
Not in practice. The footer mentions a guard, but matching runs on the page's main thread with only a cap of 500 matches. A pattern like (a+)+$ against a long non-matching line can freeze the tab until you reload.
Why can the exported snippets behave differently from my test?
The Python snippet carries only the i flag, the Go snippet carries no flags, and the PHP snippet appends the raw flag letters including g, which PCRE does not accept. Adjust modifiers by hand before using them.
What limits apply to matches and details?
Up to 500 matches are gathered and only the first 50 reach the captures table. Zero-length matches step forward by one character so the loop ends. The y and d flags are not offered, and the share link is written but not read back when opened.
How does replacement work?
It calls String.replace with your replacement text, so $1, $2 and $& work. Without the g flag only the first hit is replaced, so untick g to see that difference. Unmatched groups show as empty quotes in the captures table.