Calcuva
DV · Development Engine

Regex Tester: Build & Debug Regular Expressions Online

Write a pattern, toggle the g/i/m/s/u/y flags, and watch every match, capture group and index update in real time against your test string. Runs on the native browser RegExp engine, fully in your browser with nothing uploaded.

Pattern

Tested live as you type

//g
Flags
2
Matches
3
Groups

How to use this tool

1
Write Your Pattern

Type a regular expression between the slashes — the tester compiles it live with the native browser RegExp engine.

2
Toggle Flags

Switch on g (global), i (ignore case), m, s, u or y to control how matching behaves and see results update instantly.

3
Inspect Matches

Paste your test string to highlight every match and read each one's index and capture groups, with a live match count.

Pro Tip

Without the g flag only the first match is returned — turn it on whenever you expect more than one hit.

Everything runs in your browser. Nothing is uploaded.

Contact jane@example.com or sales@acme.io for help.
"jane@example.com"Index 8
$1"jane"$2"example"$3"com"
"sales@acme.io"Index 28
$1"sales"$2"acme"$3"io"

Stop Guessing at Your Regular Expressions

A regular expression that looks correct can silently fail on the one edge case that matters. This regex tester lets you write a pattern, flip the flags you need, and watch every match light up in your test string in real time. Because it runs on your browser's own JavaScript engine, what you see here is exactly what your code will do.

What This Tool Does

You type a pattern into the slashes, toggle any of the six standard flags, and paste the text you want to check. The tester compiles your pattern with new RegExp(pattern, flags) inside a try/catch and immediately shows:

  • A live highlight of the test string with every match marked.
  • A match count so you know whether your pattern is too greedy or too strict.
  • Per-match details including the matched text, its character index, and each capture group ($1, $2, …) plus any named groups.

If the pattern can't compile, you get a clear Invalid Regex message with the engine's own explanation — no silent failures, no crash.

A Worked Example: Pulling Dates From a Log

Suppose you have a log line and want to extract the date pieces:

Order shipped on 2026-06-29 and delivered on 2026-07-04.

Enter the pattern (\d{4})-(\d{2})-(\d{2}) with the g flag on. The tester finds two matches. For the first, it reports the matched text 2026-06-29 at index 17, and breaks out three capture groups: $1 = "2026", $2 = "06", $3 = "29". Switch the groups to named ones — (?<y>\d{4})-(?<m>\d{2})-(?<d>\d{2}) — and the results now label them y, m, and d, mirroring how you'd read match.groups.y in code. This is the fastest way to confirm your extraction logic before wiring it into a parser.

When Developers Reach For It

  • Validation rules — confirm an email, phone, or slug pattern accepts the good inputs and rejects the bad ones.
  • Search-and-replace — verify which substrings a pattern catches before running a risky find/replace across a codebase.
  • Log and data mining — pull IDs, timestamps, or error codes out of raw text and inspect the captured groups.
  • Learning regex — toggle i, m, or s and instantly see how each flag changes the result, which is far faster than reading the spec.

Pay attention to the g and y flags: without g, only the first match is returned, which often explains a "why is it only finding one?" surprise. The index shown for each match is just as useful — it tells you exactly where in the string a match begins, which is essential when you plan to slice, replace, or insert around it. Seeing both the text and its position side by side removes the usual guesswork of counting characters by hand.

Reading Capture Groups Like Your Code Will

The match details panel mirrors how the engine returns results to a program. The full match is element zero of the array, and each parenthesised group follows as $1, $2, and so on. A group that is optional and didn't participate — say the s in colou?r — is reported as , exactly the undefined you'd get in JavaScript. Named groups appear under their names, so a pattern built for match.groups.year reads the same here. Verifying this mapping in the tester first means fewer surprises when you copy the pattern into an actual parser or validator.

Built for Privacy and Safety

Nothing you enter is uploaded. The pattern and the test string stay in memory in your browser, so testing against production logs or customer data is safe. To keep the page responsive, global matching is capped at 10,000 iterations and empty matches advance automatically — so a pattern like a* against a long string won't lock up your tab.

Pair It With Other Tools

Regex work often goes hand in hand with reshaping text. After you've confirmed a pattern, clean up casing with the text case converter, or check length limits on your sample data with the word & character counter. Together they cover most quick text-wrangling tasks without ever leaving the browser.

Common Questions

Expert FAQ