Regex Tester
Test regular expressions, highlight matches, and read any pattern back as a plain-language token breakdown with cross-language equivalents.
This tool runs entirely in your browser. Your input is never uploaded.
No matches//giWhat is a regular expression?
A regular expression is a pattern for finding, validating, or extracting text. It can describe simple literal words as well as structured values such as URLs, dates, identifiers, and log fields.
How to test a pattern
- Enter a pattern between the slashes.
- Select flags such as
g,i,m,s,u, ory. - Enter the text to search.
- Review highlighted matches, positions, capture groups, and the JavaScript literal.
The tester uses the browser's native JavaScript RegExp implementation, so its syntax follows the JavaScript runtime.
Flags
g finds all matches, i ignores case, m enables multiline anchors, s lets dots match line breaks, u enables Unicode mode, and y enables sticky matching from the current position.
Performance and privacy
Text and patterns stay in your browser. Matching runs in a Web Worker with a short time limit so an expensive expression cannot freeze the page. The tool caps input at 100,000 UTF-16 code units and displays at most 1,000 matches.
Regular expressions can still be difficult to reason about. Avoid nested ambiguous quantifiers such as (a+)+ when processing untrusted or very large input.
Capture groups
Parenthesized groups are shown for each match. Named groups are displayed with their names. An optional group that did not participate is shown as unmatched.
How to read the breakdown
The Explain tab turns a pattern into a list of tokens, in the same order they appear in the pattern.
- Enter a pattern; the breakdown updates as you type.
- Select a colored chip to jump to that token in the list below.
- Read each row: the raw characters on the left, what they mean in plain language, and the group it belongs to.
Rows are indented by nesting level, so the tokens inside a group sit one step further in. Group delimiters sit at the level of their own group, which makes it easy to see where a group starts and ends.
What the Explain tab looks for
- Nested quantifiers such as
(a+)+, the classic cause of catastrophic backtracking - Quantifiers with nothing to repeat, for example a leading
* - Empty alternatives such as
a|or|a, and empty groups or character classes - Redundant escapes such as
\-, which change nothing - Constructs JavaScript does not support, including inline flags like
(?i), atomic groups(?>…)and possessive quantifiers - Backreferences to groups that do not exist, by number or by name
Regex in other languages
The Explain tab rewrites your pattern for Python, Java, Go and PHP. Named groups become (?P<name>…) in Python, \u{1F600} becomes \U0001F600 there and \x{1F600} elsewhere, and the i, m and s flags move into an inline (?ims prefix.
Anything that cannot be translated exactly is called out rather than silently approximated. Go's engine has no lookaround and no named backreferences, Java needs UNICODE_CHARACTER_CLASS for Unicode properties, and the g and y flags drive the matching loop in JavaScript rather than the pattern, so they have no equivalent.
Frequently asked questions
Why do I see only one match?
The g flag is required to find all matches. Without it, JavaScript returns only the first match.
Why did a pattern fail?
Check the pattern syntax, flags, escaping, and whether the JavaScript engine supports the feature you used. The Explain tab reports the engine's own message and still breaks down everything it recognised.
Why does a pattern work in Python but not here?
Dialects differ. Python and PCRE add syntax JavaScript lacks, such as inline flags and atomic groups, and they spell named groups differently. The Explain tab translates the pattern and flags the parts that cannot be carried over.
Does the Explain tab send my pattern anywhere?
No. Patterns are analysed in your browser, and so is the text you test.