Free online regex tester and explainer
Type a regular expression and see every match highlighted in your text instantly, with capture groups, named groups, positions and a plain-English explanation of each part of the pattern. Everything runs in your browser, so your text stays private.
What this regex tester does
- Live matching: matches update as you type, with alternating highlights so adjacent matches are easy to tell apart.
- Groups and named groups: see each capture group and (?<name>…) value for every match, including their positions.
- Replace mode: preview a replacement using $1, $& or $<name> before you use it in code.
- Explanation: a token-by-token breakdown turns a cryptic pattern into readable steps, indented by group.
- Examples: start from ready-made patterns for emails, URLs, phone numbers, dates, hex colors and IPv4 addresses.
Regex syntax cheat sheet
- \d \w \s: a digit, a word character and whitespace. Capital letters (\D \W \S) mean the opposite.
- . ^ $: any character, the start of the text or line, and the end of the text or line.
- * + ? {n,m}: zero or more, one or more, optional, and a specific range of repeats. Add ? after any of them to make it lazy.
- [abc] [^abc] [a-z]: any of these characters, none of these characters, and a range.
- (…) (?:…) (?<n>…): a capture group, a non-capturing group and a named group.
- (?=…) (?!…) (?<=…) (?<!…): lookahead, negative lookahead, lookbehind and negative lookbehind.
Safe against runaway patterns
Patterns with nested quantifiers such as (a+)+ can take exponential time on some inputs (catastrophic backtracking). This tester runs your pattern in a background worker and stops it after a moment, so a bad pattern can never freeze your browser tab.
Frequently asked questions
Which regex flavor does this use?
JavaScript (ECMAScript) regular expressions, the same engine used in browsers and Node.js. Most syntax also works in other languages, but features like lookbehind, named groups and flags differ between flavors.
What do the g, i, m, s, u and y flags do?
g finds all matches, i ignores case, m makes ^ and $ match at line breaks, s lets . match newlines, u enables full Unicode matching and y matches only at the last position (sticky).
Why does my pattern say it is taking too long?
It probably contains nested or overlapping quantifiers that cause catastrophic backtracking on your text. Make the pattern more specific, for example by replacing (a+)+ with a+.
Is my text uploaded?
No. Matching happens entirely in your browser.