Regex tester
Type a pattern and some test text. Every match is highlighted as you type, with its capture groups listed underneath. This uses your browser's own JavaScript regex engine.
runs in your browser · nothing uploaded
How to use it
- Type your pattern without the surrounding slashes.
- Toggle flags: g (all matches), i (ignore case), m (multiline ^ and $), s (dot matches newline), u (Unicode).
- Paste test text. Matches highlight live and each one is listed with its position and groups.
- Fill in Replace to preview a replacement. Use $1, $2 or $<name> to insert groups.
Which regex flavour this is
This is the ECMAScript engine built into your browser, the same one Node.js uses. It supports lookbehind, named groups (?<name>...) and Unicode property escapes such as \p{L} with the u flag.
Other languages differ in places. Python's re module has no \p{...} classes, and PCRE (PHP) supports possessive quantifiers and recursion that JavaScript does not. Test there too before you ship a pattern to another language.
Patterns that hang
Nested quantifiers such as (a+)+$ can take exponential time on input that almost matches. This is called catastrophic backtracking and is a known denial-of-service bug (ReDoS). If this page freezes on your pattern, that is the cause: simplify the nesting before using the pattern on user input.
Questions
Is what I paste sent to a server?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is uploaded, logged or stored by us, so it is safe to use with real data.
Why does my pattern only find the first match?
Turn on the g flag. Without it, JavaScript stops at the first match.
How do I match a literal dot or bracket?
Escape it with a backslash: \. matches a dot, \[ an opening bracket. Inside [...] a dot is already literal.
Can I use this for Python or PHP patterns?
Simple patterns behave the same. Advanced features differ, so test advanced patterns in the target language as well.