Write a regular expression, paste some sample text, and see exactly what matches — including every capture group and its position in the string.
How to use this tool
- Type your pattern without the surrounding slashes: write
\d+, not/\d+/g. - Tick the flags you need.
- Paste test text underneath.
- Every match is listed with its index and any groups it captured.
What the flags do
- g (global) — find every match instead of stopping at the first
- i (ignore case) — treat
Aandaas the same - m (multiline) — make
^and$match at each line break, not just the start and end of the whole string - s (dotall) — let
.match newline characters too - u (unicode) — enable
\p{...}property escapes and correct handling of characters outside the basic plane
Tips
- Use named groups —
(?<year>\d{4})— and they appear by name in the results. Far easier to maintain than counting bracket positions. \bmarks a word boundary and is usually what you want instead of wrapping a pattern in spaces.- Beware catastrophic backtracking: nested quantifiers like
(a+)+bcan take exponential time on a non-matching string. This tool caps results to keep the page responsive, but the underlying pattern would still be slow in production. - This uses the JavaScript regex engine. PCRE, Python, and Go differ in places — notably lookbehind support and named-group syntax.
Related tools
- Text diff checker — compare before and after a bulk replace
- Line sorter & deduplicator — clean up lists without regex
- Word counter — quick stats on the same text
- Case converter — normalise case before matching
FAQ
Is my text sent to a server?
No. The pattern is compiled with the browser's own RegExp engine and run locally.
Why does my pattern only find one match?
You almost certainly need the g flag. Without it, the engine stops at the first match by design.
Why is my pattern with a lookbehind failing?
Lookbehind — (?<=...) — is supported in all current browsers but was a late addition. If you are copying a pattern from a Python or PCRE example, also check the escape syntax, which differs.
How do I match a literal dot or slash?
Escape it with a backslash: \. for a dot, \/ for a slash. Inside a character class, [.] also works and reads more clearly.
Does this support replace?
Not yet — this tool focuses on matching and group inspection so you can get the pattern right first.
More developer tools
- Base64 Encoder & DecoderEncode text to Base64 or decode Base64 back to text, right in your browser. Handles emoji and accented characters correctly, with URL-safe output.
- HTML Entity Encoder & DecoderEscape HTML so tags display as text, or decode entities back into characters. Supports all HTML5 named entities, in your browser.
- JWT DecoderDecode a JSON Web Token to read its header, payload, and expiry. Runs entirely in your browser — the token is never sent anywhere.
- URL Encoder & DecoderPercent-encode text for URLs or decode an encoded URL back to readable text. Choose component or whole-URL mode, all in your browser.