All tools

Regex Tester

Test regular expressions with live match highlighting

//
Matches · 2
Hello world from Multilities
[0]Hello world($1=Hello, $2=world)
[1]from Multilities($1=from, $2=Multilities)

How it works

Regex TesterTest regular expressions with live match highlighting. All processing happens in your browser — no upload, no signup, no email required. Free forever.

Last updated:

About Regex Tester

Regex is one of those skills where a thirty-second test loop saves an hour of staring. Paste a pattern, paste a sample string, watch matches highlight live as you tweak flags or fix a wayward bracket. This regex tester uses the JavaScript RegExp engine — the exact same one your code will run in the browser, in Node.js, or in any V8/JavaScriptCore-based runtime — so what you see here is what you will get in production.

The flag toggles cover everything ECMAScript supports: g for global, i for case-insensitive, m for multi-line ^/$ anchors, s for dotAll ("." matches newlines), u for full Unicode, and y for sticky matching. Each match shows you its full text, the index, and any capture groups (numbered and named) so you can build and verify the exact extraction shape your code expects.

Regex flavours vary: PCRE in PHP, RE2 in Go and Cloud Logging, .NET's engine, and Python's re module all differ on lookbehind syntax, possessive quantifiers, and Unicode property escapes. This tester targets ECMAScript / JavaScript specifically — if you are writing patterns for a Go service or a BigQuery query, double-check the dialect before shipping.

How to use Regex Tester

  1. Type or paste your regex pattern into the Pattern field (no surrounding slashes needed).
  2. Toggle the flags you need: g, i, m, s, u, y. Each one updates the live match list immediately.
  3. Paste a representative test string into Test string — multi-line input is fine.
  4. Read the Matches panel: each entry shows the full match plus any capture groups, numbered and named.
  5. Tweak the pattern until "No matches" disappears and the highlighted spans cover what you expect.
  6. If you see "Invalid regex", check for an unclosed group, an unescaped character class, or a flag conflict.

Common use cases

  • Building an input-validation pattern for an email, slug, or phone field before pasting it into your form library.
  • Extracting structured fields (timestamps, request ids, status codes) from log lines for a quick analysis script.
  • Refining a search-and-replace pattern in your editor with capture group references like $1, $2.
  • Checking that a destructive find-and-replace will only hit the lines you expect before running it on a real file.
  • Teaching a teammate why ".*" is greedy and how lazy quantifiers (".*?") behave differently.

Tips & common mistakes

  • Without the g flag, only the first match is returned — turn it on whenever you are extracting all occurrences.
  • If you need "." to match newlines, enable the s (dotAll) flag instead of resorting to "[\s\S]".
  • Use named capture groups like "(?<year>\d{4})" so callers can reference match.groups.year instead of fragile numeric indexes.
  • ECMAScript supports lookbehind ("(?<=…)") in modern browsers but Safari was a late adopter — verify on your target runtimes if you need to support older devices.

Frequently asked questions

Which regex flavour does this support?

JavaScript's native RegExp engine, the same one used in browsers and Node.js. ECMAScript flags g, i, m, s, u, y are supported.

Can I see capture groups?

Yes. Each match shows captured groups numbered $1, $2, …. Named groups appear in the JSON output of each match.

Why does '.*' match too much?

By default '.' doesn't match newlines. Toggle the 's' (dotAll) flag if you need '.' to match every character including line breaks.

Does this support PCRE features like recursive patterns or possessive quantifiers?

No. This is the JavaScript RegExp engine, which is ECMAScript-compliant. Recursive patterns, possessive quantifiers ("++", "*+") and certain PCRE conditionals are not supported. For those, use a PHP/Perl/PCRE-specific tool.

Can I test patterns destined for Go (RE2) or BigQuery?

You can prototype the basic shape, but RE2 deliberately omits lookbehind and backreferences for performance and safety. Always re-verify in the target dialect — this tool is JS-flavoured.

Why does my pattern silently match too much?

Quantifiers are greedy by default — ".*" eats as much as possible. Add "?" to make them lazy (".*?"), or use a more specific character class like "[^/]*" instead of ".".

Latest from the blog

Related tools