RUNWEBTOOLS
English

Regex Tester

Test regular expressions with live match highlighting, groups, and replace.

//g

Examples

Match email addresses (g flag)

Input

Pattern: (\w+)@(\w+)\.(\w+)

Output

Highlights ada@example.com, grace@navy.mil — with groups ada / example / com

Replace with capture groups

Input

Replacement: $1 [at] $2

Output

ada@example.com → ada [at] example

Find all numbers

Input

Pattern: \d+  (flag: g)

Output

Matches every run of digits in the text

About this tool

This free online regex tester lets you build and debug regular expressions with instant feedback. Type a pattern, toggle the flags, and paste in some text — every match is highlighted live, with a breakdown of the capture groups and an optional replace preview. Everything runs in your browser with no upload.

How to use

  1. Type your pattern in the expression field (no surrounding slashes needed).
  2. Toggle flags like g (all matches) and i (case-insensitive).
  3. Paste your text into the test string box to see matches highlighted.
  4. Optionally add a replacement (use $1, $2) to preview a substitution.

What you get for each match

  • Live highlighting of every match directly in your text.
  • Capture groups broken out ($1, $2, and named groups).
  • A match count so you can confirm a pattern behaves as expected.
  • A replace preview before you commit a find-and-replace.

New to regex?

Regular expressions look cryptic at first but come down to a few building blocks. Our beginner's guide to regex walks through them from scratch, the regex cheat sheet is a quick syntax lookup, and common regex patterns gives you ready-made expressions for email, URLs, dates, and more to test here. To apply a pattern across a block of text, try find and replace.

Frequently asked questions

Is this regex tester free?

Yes — it's a completely free online regular expression tester with no sign-up. Test as many patterns as you like.

Is my text sent to a server?

No. Your pattern and test string are evaluated entirely in your browser with no upload, so nothing leaves your device.

Which regex flavor does it use?

JavaScript's built-in RegExp engine, which shares its core syntax with most modern flavors (PCRE, Python, Java) — character classes, quantifiers, groups, lookarounds, and named groups all work.

What do the flags g, i, m, s, u, y mean?

g finds all matches, i is case-insensitive, m makes ^ and $ match line breaks, s lets . match newlines, u enables full Unicode, and y is sticky matching. Toggle them and the results update live.

How does the replace preview work?

Type a replacement in the optional field and the result appears below. Use $1, $2 for numbered capture groups and $<name> for named ones, exactly like String.replace.

Why are only some matches highlighted?

Without the g (global) flag, a regex matches only the first occurrence. Turn on g to highlight every match in the test string.

Do I need to add slashes or escape my pattern?

No. Type the pattern only — the slashes shown around it are just for display. Escape special characters with a backslash as usual, for example \. to match a literal dot.

Learn more

Related tools