What is the Regex Tester?
Write a regular expression and see every match highlighted in your test text as you type, with the position and capture groups of each match listed below. Add a replacement to preview a search-and-replace before running it in your code.
It uses JavaScript’s own regex engine, the same one used by browsers, Node.js and React Native, and includes ready-made patterns for common Indian formats such as mobile numbers, PIN codes, PAN, GSTIN and IFSC codes. Patterns run in the background, so one that takes too long is stopped instead of freezing the page.
How to use it
- Type a pattern, or pick a ready-made one.
- Choose flags, such as g to find all matches or i to ignore case.
- Type or paste test text; matches are highlighted as you type.
- Optionally add a replacement to preview the result.
Example
Pattern: \b[6-9]\d{9}\b Text: Call 9876543210 or 12345678901 match: 9876543210 at position 5
Features
- Live highlighting. Every match is highlighted in the test text as you type.
- Groups. Numbered and named capture groups for every match.
- Replace preview. Use $1, $<name> and $& in the replacement and see the result instantly.
- Indian presets. Mobile number, PIN code, PAN, GSTIN and IFSC, plus email, URL, date, IP and colour.
- Safe to experiment. Patterns that take too long are stopped automatically.
- Cheat sheet. A quick reference of the most-used regex syntax.
Frequently asked questions
Which regex flavour does this use?
JavaScript (ECMAScript) regular expressions, as used in browsers, Node.js, Deno and React Native. Most syntax is shared with Java, Python, PHP and Kotlin, but some features differ, such as lookbehind support and named group syntax in older engines.
Why does my pattern only find one match?
Without the g (global) flag, a regular expression stops at the first match. Turn on g to find all of them.
What do ^ and $ match with the m flag?
Normally ^ and $ match only the start and end of the whole text. With m (multiline) they match the start and end of every line, which is what you want when testing one value per line.
What is catastrophic backtracking?
Some patterns, such as (a+)+$, can take exponentially long on certain inputs. This tool stops any pattern that runs longer than a second and tells you; rewrite the pattern to avoid nested repetition.
Is my text uploaded?
No. Everything runs in your browser.
Last updated · Free, no sign-up, runs in your browser.