Regex Tester – Test Regular Expressions Online

Test a regular expression against your text with live highlighting, capture groups and replace — JavaScript flavour, with ready Indian patterns.

Last updated:

//

Replace

Regex tester

Writing a regular expression by trial and error is much faster when you can see the results live. Type a pattern and flags, paste your text, and this regex tester highlights every match, lists its position and capture groups (including named groups), and previews afind-and-replace. It uses the JavaScript engine, and includes ready-made patterns forIndian mobile numbers, PIN codes, PAN, GSTIN, IFSC and UPI IDs to start from.

How to use it

  1. Type a pattern (without the surrounding slashes) and flags, or pick a sample.
  2. Paste the text to test — matches highlight as you type.
  3. Check the groups table, or open Replace to preview substitutions.

Example

With the pattern [6-9]\d9 and the g flag, the sample text matches 9876543210 and 8123456789 — but not 5123456789, because Indian mobiles start with 6–9. Add \b at both ends to avoid matching inside longer numbers. For simple find-and-replace without regex, use find and replace.

Rate this tool

Frequently asked questions

Which regex flavour does this use?
JavaScript regular expressions — the same engine used in browsers and Node.js. Most syntax (character classes, groups, lookahead, named groups) also works in Python, Java and PHP, with small differences.
What do the flags mean?
g finds all matches instead of just the first, i ignores upper/lower case, m makes ^ and $ match at each line, s lets the dot match new lines, and u enables full Unicode (needed for emoji and \p{…} classes).
How do I match an Indian mobile number or PIN code?
Pick the sample patterns from the list: an Indian mobile is ^[6-9]\d{9}$ and a PIN code is ^[1-9]\d{5}$. They check the format only, not whether the number exists.
Why does my browser freeze with some patterns?
Patterns like (a+)+ can take exponential time on long text (“catastrophic backtracking”). The tester stops after 1,000 matches, but avoid nested repeats like that in real code.