Skip to content
ToolboxHere home

Regex tester

A regex checker for JavaScript: type a regular expression and see every match lit in your text, with the groups in a table and a plain-words reading of the pattern. Replace with $1 or $<name>, toggle the flags, and insert ready-made patterns (a small regex generator) for emails, URLs, dates, Pakistani phone numbers and CNICs.

  • Nothing you type leaves your device
  • 100% free
  • No sign-up
  • Instant results
Regex TesterTest a JavaScript regular expression live: matches lit in your text, groups in a table, replace, and a plain-words explanation.Starting… the tool runs entirely in your browser and needs JavaScript.

How to use Regex Tester

  1. Type the pattern in the box (JavaScript syntax, as in new RegExp) and toggle the flags: g for every match, i to ignore case, m for line-by-line ^ and $.
  2. Paste the text to test. Matches are lit in alternating colours; the table lists each match with its capture and named groups.
  3. Open Replace to try a replacement with $1, $<name> or $&, and copy the result.
  4. Read "What the pattern means" to check the regex says what you intended, or tap Insert for a tested pattern.

Why use Regex Tester

Never freezes

The pattern runs in a background worker and is stopped after 2 seconds, so a runaway pattern such as (a+)+ cannot hang the page.

Groups in a table

Numbered and named groups side by side for every match, with Copy as JSON for your tests.

Explained in words

Each piece of the pattern is read out: "a digit, exactly 3 times", "group 'user' capturing…".

Regional presets

Email, URL, ISO date, IPv4, hex colour, and the formats people here need: Pakistani mobile numbers and CNICs, Qatar QIDs.

About this tool

A regular expression is a pattern for finding and checking text: an email in a form, a date in a log, a phone number in a spreadsheet. Writing one is fast; being sure it matches what you meant is the slow part. This tester lights every match in your text as you type, shows the capture groups in a table, and reads the pattern back in plain words so a missing escape or a greedy repeat is easy to see.

It uses JavaScript's regex engine, the same one your browser and Node run, with all six flags. Patterns run in a background worker with a two-second limit, so a catastrophic backtracking pattern stops with a message instead of freezing the tab. Nothing you paste is sent anywhere.

Frequently asked questions

Is this the same regex as Python or Java?

The syntax is shared for the most part (classes, groups, quantifiers, lookahead), but this page runs JavaScript's engine. Lookbehind and named groups work; Python's (?P<name>…) spelling and possessive quantifiers do not.

Why is only the first match shown?

The g (global) flag is off. Turn it on to see every match, as String.matchAll or replace with g would.

How do I use a group in the replacement?

$1 for the first group, $<name> for a named group, $& for the whole match, and $$ for a literal dollar sign.

What does the time-out message mean?

The pattern took more than 2 seconds on this text, almost always because of nested repeats such as (.*)* or (a+)+ that backtrack exponentially. Make the inner part more specific.

Which email pattern should I use?

The Email preset matches the everyday forms without trying to implement the whole RFC. For a sign-up form, the only real check is sending a confirmation email.

Does this regex tester online send my text anywhere?

No. The pattern and test text are checked in your browser with JavaScript regular expressions, so nothing is uploaded.

Related tools