Skip to content

Regex Tester — Test & Debug Regular Expressions Online Free

Test regular expressions online free with real-time match highlighting, capture groups and flag support. Uses the native JavaScript regex engine — paste a pattern and test string to debug instantly. Runs entirely in your browser.

Last updated: June 2026

🔒 100% client-side — your data never leaves your browser. No upload, no account.
/ /

Common patterns

Highlighted matches

 

Matches

Quick reference
. any character
\d digit · \D non-digit
\w word char · \W non-word
\s whitespace · \S non-space
* 0 or more · + 1 or more
? optional (0 or 1)
5 between 2 and 5
^ start · $ end
[abc] any of a, b, c
[^abc] none of a, b, c
(…) capture group
a|b a or b

About this tool

Build and debug regular expressions live

Regular expressions are one of the most powerful — and most error-prone — tools a developer uses. A regex tester takes the guesswork out: type a pattern, paste some sample text, and every match lights up instantly so you can see exactly what your expression captures and what it misses. This tester uses the browser's native JavaScript RegExp engine, so the behaviour here is identical to what you'll get in your code.

Toggle the standard flags — g for global, i for case-insensitive, m for multiline and s for dotAll — and watch the matches update. Each match is listed with its position in the string and a breakdown of every capture group, which is essential when you're extracting structured data like dates, phone numbers or IDs. If your pattern is invalid, the exact engine error is shown so you can fix it in seconds.

The common-pattern presets give you a tested starting point for everyday needs — email addresses, URLs, Indian and US phone numbers, dates, pincodes, PAN cards, IP addresses and Aadhaar numbers — that you can adapt to your case. Copy the finished expression with its flags, or export all matches as JSON for use elsewhere. Everything runs locally in your browser, so you can safely test patterns against logs or private data, with no account and no limits.

How it works

Three quick steps — no account, nothing uploaded to a server.

1

Enter a pattern

Type your regular expression and pick the flags you need.

2

Add a test string

Paste text — matches highlight and list in real time.

3

Inspect & copy

Check capture groups, then copy the regex or matches as JSON.

Was this tool helpful?

Rate this tool:

FAQ

Frequently asked questions

What is a regex tester?

A regex tester is a tool that lets you write a regular expression, run it against sample text, and instantly see which parts match. Instead of guessing whether a pattern works, you watch the matches highlight in real time, inspect capture groups, and fix errors as you go. This tester uses the browser's native JavaScript regex engine, so the behaviour matches exactly what you'll get in JavaScript code.

What do the regex flags g, i, m and s do?

The g (global) flag finds all matches rather than stopping at the first; i makes matching case-insensitive; m (multiline) makes ^ and $ match at line breaks rather than only the start and end of the whole string; and s (dotAll) makes the dot . match newline characters too. This tester always enumerates every match so you can see them all, and lets you toggle i, m and s to suit your pattern.

What are capture groups?

Capture groups are parts of a pattern wrapped in parentheses ( ), which 'capture' the text they match so you can reuse or extract it. For example, the pattern (\d{4})-(\d{2}) on '2026-06' captures '2026' as group 1 and '06' as group 2. This tester lists each capture group for every match, which is invaluable when you're pulling structured data — dates, IDs, prices — out of text.

Is the regex tested locally?

Yes. Both your pattern and your test string are processed entirely in your browser using the native RegExp engine — nothing is uploaded or stored on a server. That makes it safe to test patterns against logs, sample data or anything sensitive. Your last pattern and test text are remembered locally so they're still there if you reload.

Why does my regex show an error?

If the pattern isn't valid JavaScript regex syntax, the input border turns red and the exact engine error is shown — common causes are an unclosed group or character class, a dangling quantifier, or an unescaped special character. Fix the highlighted issue and matching resumes automatically. Remember that in this syntax you don't wrap the pattern in slashes; just type the expression itself.