Regex tester

Try JavaScript-compatible regular expressions with live matches and short token hints. Use the library for common patterns.

Pattern library

Flags:

Need more than a template?

Need something built around this?

I build internal tools, integrations and full-stack products for startups and growing teams.

Full-stack engineering →

How to use the regex tester

The tester runs your pattern with the JavaScript regular expression engine, the same one browsers and Node.js use. Matches update as you type, and each one shows its position and capture groups. A short list of hints explains the tokens in your pattern, and the pattern library has ready-made patterns you can load and change.

  1. Type a pattern or load one from the library, then set the flags. g finds every match, i ignores case, m makes ^ and $ work on each line, s lets the dot match a newline, u turns on Unicode mode and y matches only at the current position.
  2. Edit the test text. Each match appears with its index and any capture groups.
  3. Check the hints to confirm what each token means, then copy the pattern.

Worked examples

Find email-like strings

\w+@\w+\.\w+

Finds both addresses in the sample text. It is a quick check, not validation: the reliable test for an email address is sending a message to it.

Match ISO dates, one per line

^\d{4}-\d{2}-\d{2}$

Turn on the m flag so ^ and $ work on each line. It matches 2026-10-02 but not 2026-10-02T10:00.

A number followed by USD

\d+(?= USD)

The lookahead checks for the text after the number without including it in the match.

Mistakes to avoid

  • Assuming another regex flavor

    JavaScript has no possessive quantifiers or atomic groups, and named groups are written (?<name>...). A pattern written for PCRE, Python or Java may need changes before it works here.

  • Leaving the dot unescaped

    An unescaped dot matches any character, so example.com also matches exampleXcom. Write example\.com.

  • Greedy matching

    <.+> grabs everything from the first < to the last > on the line. Use <.+?> or, better, <[^>]+>.

  • Catastrophic backtracking

    Nested quantifiers such as (a+)+$ can take exponential time on a long string that almost matches, and freeze a page or a server. Keep quantified groups simple and test with long inputs.

Questions people ask

Which regex flavor is this?
ECMAScript, the JavaScript standard. If you use the pattern in JavaScript or TypeScript it behaves the same. In Python, PHP or Java, check the differences first.
Does the hint list explain every token?
No. It recognises common tokens such as \d, \w, \s, anchors, quantifiers, character classes and groups. It is a reading aid, not a full parser.
Does my test text leave the browser?
No. Matching runs locally.

Related