TextToolboxSmart text & developer utilities
My Tools

Regex Tester

Write a pattern and paste test text. Matches and capture groups highlight as you type.

Matches

How to use the Regex Tester

  1. Enter a regular expression — without the surrounding slashes.
  2. Toggle flags: g (all matches), i (ignore case), m (multiline), s (dot matches newline), u (Unicode).
  3. Paste test text; every match is highlighted and listed with its groups.
  4. Add a replacement to preview the result of String.replace, using $1 or $<name> for groups.

Quick reference

TokenMatches
\d \w \sDigit, word character, whitespace
.Any character except newline (any at all with the s flag)
^ $Start and end of text (of each line with the m flag)
* + ? {2,5}0+, 1+, 0–1, and 2 to 5 repetitions
*? +?Lazy versions — match as little as possible
(…) (?<name>…)Capture group, named capture group
(?:…)Group without capturing
[abc] [^abc]Any of, none of
\bWord boundary
(?=…) (?!…)Lookahead, negative lookahead

About the built-in patterns

The email and URL presets are practical, not perfect. A fully RFC-compliant email regex is thousands of characters long and still cannot tell you whether an address exists. Use a simple pattern to catch typos, then confirm by sending an email.

This tester uses your browser’s JavaScript engine, so results match exactly what your JavaScript or TypeScript code will do. Other flavors (PCRE, Python, Java) differ in details such as lookbehind support and named-group syntax.

Frequently asked questions

Which regex flavor is this?

JavaScript (ECMAScript), as implemented by your browser. It supports named groups, lookbehind, Unicode property escapes (\p{L}) with the u flag, and the s (dotAll) flag.

Why do I only see one match?

Without the g (global) flag, a regular expression stops at the first match. Turn g on to find all of them.

Can a pattern freeze the page?

Patterns with nested quantifiers such as (a+)+ can take exponential time on some inputs (catastrophic backtracking). Results are capped at 1,000 matches, but avoid nested quantifiers in production code too.