Regex Tester
Write a JavaScript regular expression and see every match highlighted in your text, with numbered and named capture groups. Switch on Replace to preview a substitution.
- Runs on your device
- No sign-up
- Free, no watermark
How to use the Regex Tester
- 01Type a pattern, or pick a preset to start from.
- 02Turn flags on or off: g finds every match, i ignores case, m makes ^ and $ work per line.
- 03Paste your test text. Matches are highlighted as you type, and syntax errors are shown straight away.
- 04Read the match list for positions and capture groups.
- 05Switch on Replace and enter a replacement such as $1 or $<name> to preview the result, then copy it.
Good to know
Runs on your device
Your pattern and text stay in the browser. Nothing is uploaded.
Can't freeze the page
Matching runs in a background worker that's stopped after one second, so a runaway pattern only shows a warning.
Groups and indices
Each match lists its position and every numbered and named group. Turn on the d flag to see where each group starts and ends.
Indian ID presets
Format checks for email, mobile numbers, PIN codes, PAN, GSTIN and IFSC, each with valid and invalid examples.
Frequently asked questions
Which regex flavour does it use?
Your browser's own JavaScript RegExp engine, the same one your front-end or Node.js code uses. Patterns from PCRE, Python or Java mostly work, but some features, such as possessive quantifiers, don't exist in JavaScript.
Why did it say my pattern took too long?
Some patterns, such as (a+)+$, try an exponential number of combinations on text that almost matches. The tool stops the search after one second instead of hanging. Make nested repeats more specific to fix it.
How do I use capture groups in the replacement?
Use $1, $2 and so on for numbered groups, $<name> for named groups, $& for the whole match and $$ for a literal dollar sign.
Do the PAN, GSTIN and IFSC presets check that the ID is real?
No. They only check the format, such as five letters, four digits and a letter for a PAN. They don't verify GSTIN's check character or look anything up.
Is my text sent anywhere?
No. Matching happens in a worker inside your browser tab, so you can test against logs or customer data safely.