Regex Tester
100% client-side, nothing leaves your browser

Regex Tester

Test JavaScript regular expressions with live match highlighting, capturing groups, replace testing, and a built-in cheat sheet.

Test a pattern

No signup. No server calls. Works offline once the page loads.

/ /
Flags

Highlighted matches

0 matches

Replace testing

Result

        

Common examples

How It Works

1

Write your pattern

Enter a regular expression and toggle flags like g, i, m, s, or u.

2

Paste test text

Matches highlight live as you type, with full match and capturing group details listed below.

3

Test replacements

Try a replacement string to see exactly what your pattern would produce.

Privacy note: matching runs locally using JavaScript's built-in RegExp engine. Your pattern and test text never leave your browser.

Common Uses

Form validation

Verify a pattern correctly accepts valid emails, phone numbers, or usernames.

Log parsing

Extract IP addresses, timestamps, or error codes from raw log lines.

Find and replace

Preview a bulk find-and-replace before running it in your editor or script.

Learning regex

Experiment with the cheat sheet and examples to build intuition for patterns.

Regex Cheat Sheet

Character classes

  • . — any character
  • \d — digit [0-9]
  • \D — non-digit
  • \w — word char
  • \W — non-word char
  • \s — whitespace
  • \S — non-whitespace

Anchors & boundaries

  • ^ — start of string/line
  • $ — end of string/line
  • \b — word boundary
  • \B — non-word boundary

Quantifiers

  • * — 0 or more
  • + — 1 or more
  • ? — 0 or 1
  • {n} — exactly n
  • {n,} — n or more
  • {n,m} — between n and m

Groups

  • (...) — capturing group
  • (?:...) — non-capturing
  • (?<name>...) — named group
  • (?=...) — lookahead
  • (?!...) — negative lookahead

Alternation & sets

  • a|b — a or b
  • [abc] — a, b, or c
  • [^abc] — not a, b, or c
  • [a-z] — range

Flags

  • g — global (all matches)
  • i — case-insensitive
  • m — multiline ^/$
  • s — dotAll (. matches \n)
  • u — unicode mode

Frequently Asked Questions

Which regex flavor does this tool use?

This tool uses the native JavaScript regular expression engine (ECMAScript), so results match exactly what you would get running the same pattern in a browser or Node.js.

What do the g, i, m, s, and u flags do?

g finds all matches instead of stopping at the first, i makes matching case-insensitive, m makes ^ and $ match line boundaries within multiline text, s allows . to match newline characters, and u enables full Unicode mode for code points and property escapes.

Why is my pattern not matching anything?

Common causes include forgetting the g flag when you expect multiple matches, using . without the s flag when your text spans multiple lines, or an unescaped special character like . or ( that needs a backslash to be treated literally.

Are capturing groups shown separately from the full match?

Yes. Each match lists its full matched text alongside every capturing group, including named groups, so you can verify exactly what each part of your pattern extracted.

Can I test a replacement string?

Yes. Enter a replacement pattern using $1, $2, or named group syntax like $<name>, and the tool shows the resulting text after substitution.

Is my test string or pattern sent to a server?

No. All matching runs locally in your browser using JavaScript's built-in RegExp engine. Nothing you type is transmitted anywhere.

More Tools

Want the full syntax reference? Read the Regex Cheat Sheet →

Copied