Regex Tester
This regex tester highlights matches as you type, explains the pattern in plain English, shows capture groups and replacement results, and includes ready patterns for Indian mobile numbers, PIN, PAN, GSTIN, Aadhaar format and IFSC.
Common patterns
In this pattern: \d = any digit 0-9 · \s = a space, tab or new line · \b = a word boundary · [...] = any one of the characters inside · {n} / {n,m} = repeat n times (or n to m) · + = one or more of the previous · ? = optional (zero or one) · | = either / or · (?: ) = a group that is not captured
Matches highlighted (3)
Match details
- #1
+91-9876543210at position 5 - #2
09123456789at position 21 - #3
8123456780at position 36
Result:
Call , or . Not 5123456789.
Everything runs in your browser. Nothing you type is sent or stored.
How to use Regex Tester
Pick a common pattern or type your own regular expression.
Tick the flags you need (g, i, m, s, u) and type or paste test text.
See the highlighted matches, the match details with groups, and the result of a replacement.
When to use Regex Tester
- Form validation. Check mobile, PIN, PAN and GSTIN formats before saving them.
- Data cleaning. Find and replace patterns in exported data.
- Learning regex. See what each part of a pattern does.
Limits and privacy
- Uses the JavaScript regex engine of your browser. Format checks (like PAN or Aadhaar) only test the pattern, not whether the number really exists.
- Everything runs in your browser. Nothing you type is sent or stored.
Frequently asked questions
How do I test a regex?
Type the pattern in the Pattern box (without slashes) and paste sample text in Test text. Matches are highlighted immediately and listed with their position and groups. If the pattern has a syntax error, the message appears under the box.
What does the g flag do?
The g (global) flag finds every match in the text instead of stopping at the first. Without it, only the first match is shown and a replacement changes only the first occurrence. Combine it with i to ignore case or m to make ^ and $ work on each line.
What is the regex for an Indian mobile number?
A common pattern is (?:\+91[\-\s]?|0)?[6-9]\d{9}\b. It accepts an optional +91 or 0 prefix and then 10 digits starting with 6, 7, 8 or 9. Load "Indian mobile" in the presets to try it, and adjust it if you need to allow spaces inside the number.
Related tools
Something not working with Regex Tester? Report a problem.