Text

Regex Tester

Test JavaScript regular expressions with live match highlighting, flags and capture groups.

Privacy: This tool runs entirely in your browser. Your data never leaves your device and is never uploaded to any server.

//g

How to use this regex tester

  • Type your pattern and the text you want to test it against.
  • Matches are highlighted as you type.
  • Toggle flags to change how the pattern behaves.
  • Everything runs locally in your browser.

Patterns worth keeping

A few regular expressions come up again and again. These are worth checking against your own input rather than copying blindly.

PatternMatches
^\d{5}$Exactly five digits, such as a US ZIP code
^\d{4}-\d{2}-\d{2}$An ISO date such as 2026-10-13
^https?://A URL that starts with http or https
^[^@\s]+@[^@\s]+\.[^@\s]+$A simple email shape, but not full RFC compliance
\bword\bThe whole word, not part of a longer one
^(?!.*\bTODO\b).*$Lines that do not contain TODO

What the flags do

  • g — global. Find every match instead of stopping at the first.
  • i — case insensitive.
  • m — multiline. ^ and $ match the start and end of each line.
  • s — dotAll. A dot also matches newlines.
  • u — unicode. Treat the pattern as code points rather than UTF-16 units.

Watch out for catastrophic backtracking

A pattern that nests quantifiers, such as (a+)+b, can take exponential time to fail on the wrong input.

The regex looks instantaneous on your test string and then freezes a production server. Test with a long, non-matching input before shipping anything with nested repetition.

Test the edges, not the happy path

  • Empty string, and a string of only whitespace.
  • Input that is far longer than anything you expect.
  • Unicode and emoji, if the field accepts them.
  • The string one character short of matching.

Which flavour of regex is this

The tester uses the JavaScript engine, the same one in browsers and Node.

Flavours differ in detail. Lookahead is supported, lookbehind depends on the runtime, and Python and PCRE have syntax that will not work unchanged here.

Frequently asked questions

Which flavor of regex is used?

JavaScript regular expressions, the same engine used in browsers and Node.js.

What flags are supported?

Global, ignore-case, multiline, dotAll and unicode flags.

Is the input sent anywhere?

No. Matching runs locally in your browser.

Why does my pattern match more than I expected?

Greedy quantifiers such as .* consume as much as they can. Add a question mark (.*?) to make them lazy, or anchor the pattern with ^ and $.

How do I match across multiple lines?

Turn on the dotAll flag so that . also matches newlines, or use [\s\S] instead of the dot, which works in any JavaScript version.

What is the difference between test and match?

test returns a boolean, while match returns the matched text and its capture groups. This tester highlights the matches so you can see both at once.

More Text tools