Skip to main content

Regex Tester

Test regular expressions with highlighted matches, group table, replace preview and a plain-English explanation. Includes Indian PAN and GSTIN patterns.

Test text

Stays in your browser

Matches (2)

Born 1815-12-10, died 1852-11-27.
#MatchPositionGroups
11815-12-105–15
year: 1815
month: 12
day: 10
21852-11-2722–32
year: 1852
month: 11
day: 27

What the pattern means

\ba word boundary
(?<year>start of the group named year
\da digit (0-9)
{4}exactly 4 times
)end of group
-the text "-"
(?<month>start of the group named month
0the text "0"
[1-9]any one of 1-9
|or
1the text "1"
[0-2]any one of 0-2
)end of group
-the text "-"
(?<day>start of the group named day
0the text "0"
[1-9]any one of 1-9
|or
[12]any one of 12
\da digit (0-9)
|or
3the text "3"
[01]any one of 01
)end of group
\ba word boundary

Shortcuts: Ctrl+Enter run · Ctrl+Shift+C copy result · / search (use ⌘ on Mac)

Next steps

Done here? Use the Send to… menu on the result to carry it on to String Replacer / List Compare or Text Compare.

Free Online Regex Tester and Explainer

Type a pattern and some text and see every match, group and position at once. Each part of the pattern is explained in plain English, and there is a library of common and Indian patterns. It gives developers a quick browser-based way to solve a focused regex tester task before moving the result into a project.

How to test a regular expression

Enter the pattern without slashes, tick the flags you need and type or paste the text to test. Matches are highlighted as you type, the table lists each match with its groups and position, and "Replace preview" shows the result of a replacement such as $2-$1.

Patterns for India

The library has PAN, GSTIN, IFSC, PIN code, +91 mobile, Aadhaar (format only) and vehicle number patterns. They check the shape of a value, not whether it exists. Never paste real Aadhaar numbers.

Common mistakes

  • Without the g flag only the first match is found.
  • . does not match a new line unless the s flag is on.
  • Special characters such as . ? + and ( need a backslash to match themselves.

Frequently asked questions

Which regex flavour does this use?
JavaScript (ECMAScript) regular expressions, the same engine your browser and Node.js use. Syntax from other flavours, such as inline flags (?i), possessive quantifiers or \A, is not supported and the page warns you when it spots it.
What do the flags mean?
g finds every match, i ignores case, m makes ^ and $ match at each line, s lets . match a new line, u turns on full Unicode, y matches only at the exact position, and d records where each group matched.
Why does it say a pattern took too long?
Some patterns, such as (a+)+ on a long run of a, try an enormous number of combinations. The test runs in a background task and is stopped after 2 seconds so the page stays usable. Simplify nested quantifiers.
Is my text uploaded?
No. Matching runs in your browser. Do not paste real Aadhaar or other personal numbers: use made-up values.
How do I use this regex tester tool?
Use the interactive controls above; processing stays in your browser and the result is intended as a practical starting point for development work.

More Code & Conversion

View all Code & Conversion tools →