Regex Tester
regex tester
About Regex Tester
Write a regular expression and test it against any string and see every match, its position and any named capture groups — useful for pattern matching, input validation, and text extraction.
Last reviewed
June 23, 2026
Key Features
- Lists every match with its position in the text
- Supports all standard regex flags (g, i, m, s, u)
- Shows named capture groups and their values
- Displays match count and positions
- Instant feedback without page reload
How to Use Regex Tester
- 1Enter your regular expression in the pattern field.
- 2Select the flags you need (global, case-insensitive, multiline, etc.).
- 3Paste or type the test string to match against.
- 4Click Test Regex and review each match, its position and any named group values.
Email validation pattern example
Use the pattern /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/ to test whether a string is a valid email address format. The results show whether the whole string matches the pattern.
Greedy and lazy matching, with an example
Quantifiers such as * and + are greedy: they match as much text as they can and only give characters back when the rest of the pattern needs them. Adding ? after a quantifier makes it lazy, so it matches as little as possible.
This matters most with HTML-like or quoted text. Against <b>bold</b>, the greedy pattern <.+> matches the whole string, from the first < to the last >. The lazy pattern <.+?> stops at the first > it can, so it finds <b> and </b> as separate matches.
Pattern /<.+>/g → 1 match: <b>bold</b>
Pattern /<.+?>/g → 2 matches: <b>, </b>Named groups make results easier to read
Give a group a name with (?<name>...) and the results table lists each named value next to its match. This is clearer than counting parentheses, and the same names can be used in your code later.
Pattern /(?<year>\d{4})-(?<month>\d{2})/
Groups year: 2026, month: 10Common Problems and Fixes
- A dot matches characters it should not
- An unescaped . matches any character, so example.com also matches exampleXcom. Escape it as \. when you mean a literal dot.
- Only the first match is found
- Without the g (global) flag, the engine stops after the first match. Turn g on to find every match; the tester lists up to 500.
- The pattern hangs or takes very long
- Nested quantifiers such as (a+)+ can backtrack exponentially on input that almost matches, which is called catastrophic backtracking. Rewrite the pattern without nesting quantifiers, or make the inner part more specific.
- A pattern from Python or PHP does not work
- This tester uses the JavaScript regex engine. Syntax such as Python's (?P<name>...) named groups, possessive quantifiers and some lookbehinds behave differently or are not supported.
How It Works
The tool evaluates the regular expression against the test string using the JavaScript regex engine, lists every match (up to 500 with the g flag), and reports the match count, positions, and named group values.
Privacy Notes
The pattern and test text are sent to DevTool House servers to run the match and are not stored once the result is returned. Avoid testing against text that contains passwords or personal data.
Limitations
This tester uses the JavaScript (ECMAScript) regex engine. Some patterns from Perl, Python, or PCRE flavors may use syntax not supported in JavaScript — such as variable-length lookbehind in older environments or named group syntax differences.