Matches
| # | Match | Index | Groups |
|---|
Quick reference
- .
- any character
- \d \w \s
- digit, word, whitespace
- \D \W \S
- negated classes
- [abc] [^abc]
- set / negated set
- a* a+ a?
- 0+, 1+, 0 or 1
- a{2,5}
- between 2 and 5
- ^ $
- start / end
- \b
- word boundary
- (…) (?:…)
- capture / non-capture
- (?<name>…)
- named group
- a|b
- alternation
- (?=…) (?!…)
- lookahead
- (?<=…) (?<!…)
- lookbehind
- *? +?
- lazy quantifiers
Write a pattern, paste some text and watch matches light up as you type. Capture groups, named groups and replacements are shown for every match.
How to use the Regex Tester
- 1 Enter your pattern (without slashes) and toggle flags.
- 2 Paste test text — matches are highlighted instantly.
- 3 Inspect groups in the matches table and preview replacements.
Worked examples
Input: \b(\w+)@(\w+)\.com\b with flags gi
Result: 2+ matches highlighted
Groups: user and domain
Input: (?<y>\d{4})-(?<m>\d{2})-(?<d>\d{2})
Result: Named groups y, m, d
Replace with $<d>/$<m>/$<y>
Regex flags
| Flag | Meaning |
|---|---|
| g | Find all matches, not just the first |
| i | Case-insensitive |
| m | ^ and $ match at line breaks |
| s | . also matches line breaks |
| u | Unicode mode (code points, \p{…} classes) |
| y | Sticky — match only at lastIndex |
Protection from catastrophic backtracking
Patterns such as (a+)+$ can take exponential time on some inputs and freeze a browser tab. This tester runs every match in a background worker and stops it after 1.5 seconds, so the page always stays responsive.
Runs locally
Everything happens in your browser — nothing you paste is uploaded or logged, so it is safe to use with API responses, tokens and internal data.
Frequently asked questions
Which regex flavour is used?
JavaScript (ECMAScript) regular expressions, as implemented by your browser — including lookbehind and named groups.
How do I use capture groups in the replacement?
Use $1, $2… for numbered groups, $ for named groups and $& for the whole match.
Why are zero-length matches not highlighted?
They have no width to highlight, but they are still listed in the matches table.
Related tools
JSON Formatter & Validator
Format, beautify, minify and validate JSON with syntax highlighting, key sorting and precise error locations.
Base64 Encoder
Encode text to Base64 (UTF-8 safe), with URL-safe and MIME line-wrapping options.
Base64 Decoder
Decode Base64 and URL-safe Base64 back to UTF-8 text, with clear errors for invalid input.
URL Encoder / Decoder
Percent-encode or decode URLs and query parameters, as a component or a full URI.
HTML Entity Encoder / Decoder
HTML entity encoder and decoder: escape special characters to entities, or decode named and numeric entities back to text.
Hash Generator
Generate MD5, SHA-1, SHA-256, SHA-384 and SHA-512 hashes of text or files, and verify checksums.