The Regex Tester runs a JavaScript regular expression against your sample text and lists every match with its position and capture groups as you type. It is for developers writing validation rules, log parsers, and find-and-replace patterns who want to see exactly what a pattern catches before it goes into code.
Input
Pattern: (\d{4})-(\d{2})-(\d{2}) Test string: "Due 2026-11-16, paid 2026-12-01"
Output
"2026-11-16" at index 4, groups ["2026", "11", "16"] "2026-12-01" at index 21, groups ["2026", "12", "01"]
Input
Pattern: ^\w+@\w+\.com$ Flags: im Test string: three lines, ada@example.com / not an email / GRACE@NAVY.COM
Output
"ada@example.com" at index 0 "GRACE@NAVY.COM" at index 29
Input
Pattern: (
Output
Invalid regular expression: /(/g: Unterminated group
Patterns are compiled with the browser's own RegExp engine, so they follow ECMAScript regular expression syntax, the flavor used by JavaScript, TypeScript, and Node.js. Lookbehind (?<=...), named groups (?<year>...), Unicode property escapes like \p{L} with the u flag, and the s (dotAll) and d (indices) flags are all supported in current browsers. Some features from other flavors are not: there are no possessive quantifiers, atomic groups, inline modifiers like (?i), or \A and \Z anchors, so a pattern copied from PCRE, Python, or Java may need adjusting.
Every match is collected by running the expression repeatedly with the g flag. A pattern that can match an empty string, such as a* or \b, would otherwise loop forever at the same position, so after an empty match the search moves forward by one character. Each match records the matched text, its zero-based index in the test string, and the value of each numbered capture group in order; a group that did not take part in the match is shown as an empty string. The list stops at 1,000 matches.
The pattern runs in a Web Worker, separate from the page. If it has not finished within one second, the worker is stopped and you see a message about catastrophic backtracking instead of a frozen tab. That happens with nested quantifiers such as (a+)+$ or (\w+\s?)*$ on input that almost matches, because the engine tries an exponential number of ways to split the text. The fix is usually to make the inner part unambiguous or anchor it, and testing here is a safe way to catch it before the same pattern blocks a server.
Flags change results more than people expect. Without m, ^ and $ match only at the very start and end of the whole test string, which is why the email example needs m to check each line. The i flag only matters for literal letters in the pattern, such as \.com: without it, \.com would miss "NAVY.COM", while \w already matches both cases. To use a tested pattern to edit text, paste it into find and replace with regex mode on; to check JSON instead of matching it with regex, use the JSON validator.
More Developer Tools