Regex Tester
Write a pattern, paste some text and see each match with its index and capture groups. It uses the JavaScript (ECMAScript) regex engine built into your browser.
Output
🔒 Runs in your browser. Your data is never uploaded.
How to use
- Enter the pattern without the surrounding slashes.
- Set flags: i ignore case, m multiline, s dot matches newline, u unicode.
- Read the matches and groups; they update as you type.
Engine differences
This is JavaScript syntax. Named groups are (?<name>…), lookbehind is supported, but possessive quantifiers and inline flags like (?i) from PCRE or Python are not.
Frequently asked questions
- Do I need the g flag?
- The tester always lists all matches, so g is implied. In your own code, g decides whether match() and replace() handle the first match or every match.
- Why does my pattern from Python or PHP fail?
- Some syntax differs between engines: (?P<name>…) is written (?<name>…) in JavaScript, and inline modifiers such as (?i) are not supported.
- Why is the page slow with my pattern?
- Nested quantifiers such as (a+)+ can cause catastrophic backtracking on certain inputs. Make the pattern more specific or avoid nesting repeated groups.
Related tools
- Text DiffCompare two texts line by line and see what was added and removed.
- Remove Duplicate LinesRemove duplicate lines from a list while keeping the original order.
- JSON Formatter & ValidatorFormat, validate and minify JSON in your browser.
- Case ConverterConvert text between UPPER CASE, lower case, Title Case, Sentence case, camelCase, PascalCase, snake_case and kebab-case instantly.