Regex Tester

Write a regular expression and see every match highlighted as you type, with capture groups and positions. Start from a ready pattern such as email, Indian mobile number, PAN or PIN code.

Test a regular expression

JavaScript syntax · matches update as you type.

Flags

Results

No pattern

Match details & capture groups

How to use it

  1. Type a pattern between the slashes, or pick one of the common examples.
  2. Choose flags: g finds every match, i ignores case, m makes ^ and $ work per line, s lets . match line breaks, u enables Unicode, y matches only at the current position.
  3. Paste the text to test. Use "Test each line" to check a list of values, such as email addresses, one per line.
  4. Read the results: highlighted matches, the number of matches, and every capture group for each match.

Good to know

JavaScript flavour
Patterns run with your browser's JavaScript regex engine, the same one Node.js uses. Most syntax is shared with Python, PHP and Java, but some features (such as possessive quantifiers) differ.
Protected against runaway patterns
Each test runs in a background worker with a two-second limit. A pattern that backtracks endlessly is stopped and reported instead of freezing the page.
Named groups
Groups written as (?<name>…) are shown with their name next to the number, so you can see exactly what each part captured.

Frequently asked questions

Why do I only see one match?

Without the g (global) flag a regular expression stops after the first match. Tick g to find all of them.

What is the difference between "All matches" and "Test each line"?

"All matches" searches the whole text. "Test each line" checks every line separately and tells you which lines match — useful for validating a list of values with a pattern that uses ^ and $.

Can I use this pattern in Python or PHP?

Usually yes. Character classes, groups, quantifiers and anchors work the same. Check named groups (Python writes them as (?P<name>…)) and flags, which are written differently in each language.

Why was my pattern stopped?

It ran for more than two seconds, which usually means catastrophic backtracking — typically nested quantifiers such as (a+)+ or (.*)*. Make the inner part more specific.

Say hello

Let’s connect.

Have an idea, a project, a collaboration — or just want to say hello? I read every message.

Write to me