Skip to content

Regex Tester: how to use it (and a quick reference)

A short guide to testing regular expressions — the flags, common patterns, capture groups, and how to read the results.

Open the Regex Tester →

What this tool does

The Regex Tester runs your pattern against a test string using the browser's JavaScript regex engine, highlights every match, and lists each match with its capture groups — updating as you type.

How to use it

  1. Open the Regex Tester.
  2. Type a pattern between the slashes and set any flags (e.g. gi).
  3. Enter a test string; matches highlight instantly.
  4. Read the match list below for positions and capture groups.

The flags

  • g — global: find all matches, not just the first.
  • i — case-insensitive.
  • m — multiline: ^ and $ match at line breaks.
  • s — dotall: . also matches newlines.
  • u — full Unicode handling.
  • y — sticky: match only at lastIndex.

Handy building blocks

  • \d digit, \w word char, \s whitespace; capitals negate.
  • + one or more, * zero or more, ? optional, {2,4} a range.
  • ( ) capture group, (?<name>…) named group, (?: ) non-capturing.
  • ^ start, $ end, \b word boundary.

Reading capture groups

Each match shows its position and full text, then each numbered group and any named groups. A group that didn't participate shows as . This makes it easy to confirm a pattern is capturing the right parts before you use it in code.

It runs locally

The pattern and test string are evaluated in your browser — nothing is uploaded.

FAQ

Which regex flavour is this?

JavaScript (ECMAScript) — results match what runs in JS.

What do the flags mean?

See the list above — g, i, m, s, u, y.

Is my text uploaded?

No — it all runs in your browser.

Ready to try it? Open the Regex Tester →

Related guides