FlowToolkit
Dev

Regex Tester

Test regular expressions with live matches, groups, flags, and replace previews.

Loading tool…

About this tool

Build and debug JavaScript regular expressions in your browser. Toggle common flags, highlight matches live, inspect capture groups and match indexes, and preview replacement output without sending text anywhere.

Regex without the deploy-and-pray loop

Regular expressions are powerful, terse, and notoriously easy to get wrong. A single misplaced quantifier can match the entire string instead of just the bit you wanted; a forgotten flag can make a case-sensitive expression silently miss results. Iterating on a regex against a deployed environment is slow; iterating in a live tester is fast.

This tester uses the JavaScript RegExp engine built into your browser. Every match is highlighted as you type, with capture groups, indexes, and the full match list visible at all times. A replace preview shows you exactly what the resulting string will be — no surprises in production.

Supported flags

  • g — global, return every match instead of just the first.
  • i — case-insensitive.
  • m — multiline, ^ and $ match at line boundaries.
  • s — dotall, . matches newline characters too.
  • u — unicode, full Unicode escapes and properties.
  • y — sticky, anchor at lastIndex.
  • d — has indices, expose start and end of each capture.

Common gotchas

Greedy versus lazy quantifiers (.* versus .*?), the difference between a character class and a group, the way alternation binds with grouping, and the subtle behaviour of zero-width assertions all trip up experienced developers. Use the live highlighter to confirm that your pattern matches what you think it matches before pasting it into a code review.

Frequently asked questions

Which regex flavor is supported?

The tester uses the JavaScript RegExp engine built into your browser, which closely follows the ECMAScript regex specification. Patterns that work here will work in any JavaScript runtime.

Is my test text uploaded?

No. Matching and replacement previews run locally in your browser.

Can I inspect capture groups?

Yes. The matches table shows each match index, the full match, and every numbered capture group. Named groups are also displayed by name.

How do I test a regular expression online?

Type or paste your pattern in the regex field and your test string in the input area. Matches are highlighted live. Toggle flags (g, i, m, s, u, y, d) as needed.

What is the difference between greedy and lazy quantifiers?

Greedy quantifiers (.*, .+) match as much as possible. Lazy quantifiers (.*?, .+?) match as little as possible. The tester highlights matches so you can see the difference instantly.

How do I match across multiple lines?

Set the m flag so that ^ and $ match at line boundaries, and set the s (dotall) flag so that . matches newline characters too. Both flags are available as checkboxes.

Can I preview a regex replacement?

Yes. Enter a replacement string in the replace field. The output area shows the result with $1, $2 (or $<name>) substituting your capture groups.

Why is my regex matching the whole string?

Usually because the pattern is too permissive (.*, .+) or because you forgot to anchor it (^, $). Use the live highlighter to see exactly what is matched and tighten the pattern.