Regex Tester

Pattern & Test String

/ /

Highlighted Matches

Matches will be highlighted here.

Match Details

No matches yet.

Online Regex Tester

Test a regular expression against a string and see every match highlighted live, along with each match's capture groups — using JavaScript's native regex engine, the same one that runs in every browser and Node.js.

Features:

  • Live highlighting: Matches are highlighted in the test string as you type.
  • Capture groups: Each match's numbered groups are listed separately.
  • All standard flags: Global, ignore-case, multiline, and dot-all.
  • Client-side only: Your pattern and test data are never sent anywhere.

1. Common Regex Building Blocks

\d digit, \w word character, \s whitespace, . any character, * zero or more, + one or more, ? zero or one, ^ start of string, $ end of string, () capture group, [] character class.

2. Flags Explained

g (global): find every match, not just the first.
i (ignore case): match letters regardless of case.
m (multiline): ^ and $ match the start/end of each line, not just the whole string.
s (dot-all): let . match newline characters too.

3. A Worked Example

To match a simple email address: ^[\w.+-]+@[\w-]+\.[a-z]{2,}$ — one or more word characters, dots, plus, or hyphens, then @, then a domain, then a dot and a 2+ letter extension.

Does this test PHP or Python regex too? It uses JavaScript's regex engine specifically. Syntax is very similar across languages but not identical.
What does the "g" flag do? Global — without it, matching stops after the first match. With it, every match in the string is found.
Why does my pattern match differently than I expect? The two most common surprises: forgetting the "g" flag, and forgetting to escape special characters like "." or "(" that need a literal meaning.

Building a URL slug pattern? Try the Slug Generator for the common case.

100% client-side — your pattern and text stay private.

Related Tools