Regex Tester
Test regular expressions with live match highlighting, capture groups, flags and explanations.
Test string
Enter a pattern and some text to see matches.
How to use the Regex Tester
- Type a regular expression, or pick one from Examples.
- Toggle flags such as global, ignore case and multiline.
- Paste a test string. Matches are highlighted as you type, with their capture groups listed alongside.
- Tick Replace matches to preview a replacement using
$1,$<name>or$&. - Read the explanation to see what each part of the pattern does.
Protected against catastrophic backtracking
Some patterns, especially nested quantifiers like (a+)+ or (\w+\s?)*, can take exponential time on certain inputs and freeze a browser tab, or a server (a "ReDoS" vulnerability). Here, matching runs in a background worker and is stopped after 1.5 seconds, and the explanation warns about risky nested quantifiers before you ship them.
Which regex flavor is this?
JavaScript (ECMAScript) regular expressions, as used by browsers, Node.js and TypeScript. Most syntax is shared with Java, Python and PCRE, including lookbehind and named groups. A few features differ, such as possessive quantifiers and inline flags like (?i), which JavaScript doesn't support.
Frequently asked questions
Is my text uploaded?
No. Everything runs in your browser. Log files and data you test against never leave your machine.
Why does my pattern match an empty string?
Patterns that can match nothing, like a*, match an empty string at positions where the text doesn't match. Use + instead of * if you need at least one character.
Why do I need the g flag?
Without global, only the first match is found and only the first occurrence is replaced.
Related tools
All tools- Diff CheckerCompare two texts side by side or as a unified diff, with added, removed and changed lines.
- Cron Expression GeneratorBuild Linux cron expressions with a visual editor and preview the next run times.
- SQL FormatterFormat and minify SQL for PostgreSQL, MySQL, SQL Server and generic SQL. Queries are never executed.
- Markdown PreviewerWrite Markdown with a live, XSS-safe preview, block tracking images, and export to HTML.