Regex Tester
Test regular expressions live with matches, groups and flags.
Your pattern and test string are evaluated locally in your browser and nothing is uploaded to a server.
Comparing two strings instead? Try the Text Diff tool.
About Regex Tester
This regex tester lets you build and debug JavaScript regular expressions live, with every match highlighted in your sample text the moment you type. As an online regex tester it shows capture groups, named groups and the exact start and end positions of each match, so you can see precisely what a pattern catches. Toggle the g, i, m, s and u flags to test regular expressions under different conditions without rewriting them. It uses the same RegExp engine your browser ships with, so results match what your JavaScript code will actually do at runtime. Useful for developers writing validation, QA engineers checking parsing rules, and anyone learning regexp. Everything runs locally in your browser, so your patterns and test data never leave your device.
Features
- Highlights every match in your test string live as you type the pattern
- Shows numbered capture groups and named groups for each match
- Reports the start and end index of every match
- Toggle the g, i, m, s and u flags individually
- Uses the native browser JavaScript RegExp engine for accurate results
- Surfaces pattern syntax errors so you can fix invalid expressions fast
- Processes patterns and test text entirely in your browser
How to use the Regex Tester
- Type or paste your regular expression into the pattern field.
- Toggle the flags you need (g, i, m, s, u) above the pattern.
- Paste your sample text into the test string box.
- Read the highlighted matches, capture groups and positions in the results panel.
Example
Input
Pattern: (\w+)@(\w+)\.com Flags: g
Text: contact alice@example.com or bob@test.com
Output
Match 1: alice@example.com group1=alice group2=example
Match 2: bob@test.com group1=bob group2=test
Two matches with capture groups extracted from each email.
Common errors & troubleshooting
- Only the first match shows up even though several should match. — Enable the g (global) flag — without it RegExp stops after the first match.
- Case-sensitive pattern misses words like 'Error' vs 'error'. — Turn on the i (ignore case) flag so the pattern matches regardless of letter case.
- A dot (.) is not matching newline characters in multiline text. — Enable the s (dotall) flag so . also matches line breaks.
- ^ and $ only anchor to the whole string, not each line. — Enable the m (multiline) flag to anchor at the start and end of every line.
- Named groups or Unicode property escapes (\p{...}) throw an error. — Enable the u (unicode) flag, which is required for \p{...} escapes and strict Unicode handling.
- The pattern field shows a syntax error. — Check for unbalanced brackets or parentheses and escape literal special characters like . or ( with a backslash.
Frequently asked questions
- What is a regex tester?
- A regex tester runs a regular expression against sample text and shows you what it matches in real time. ArrayKit's Regex Tester highlights every match, lists capture groups and reports each match position so you can debug patterns visually.
- Which regex flavour does the Regex Tester use?
- JavaScript — it uses the same RegExp engine your browser runs, so matches reflect exactly how your JS code will behave.
- How do I test capture groups in the Regex Tester?
- Wrap parts of your pattern in parentheses and run it against your text. Each match lists its numbered capture groups and any named groups, along with the start and end position of the match.
- Which flags can I toggle in the Regex Tester?
- You can switch g (global), i (ignore case), m (multiline), s (dotall) and u (unicode) on or off independently to test regular expressions under different conditions.
- Can the Regex Tester handle multiline text?
- Yes. Paste multiline input and enable the m flag to anchor ^ and $ per line, or the s flag so . spans line breaks.
- Are my patterns and test data sent anywhere?
- No. The Regex Tester evaluates everything locally in your browser, so your patterns and sample text never leave your device and nothing is uploaded to a server.
Related tools
All ArrayKit tools