Regex Tester

Free online regex tester. Live match highlighting, capture group extraction, replace preview and a built-in library (email, URL, mobile, ID, date). Runs entirely in your browser.

Runs locally · data never uploaded
Advertisement

How to use

What it does

A regular expression describes text patterns with a short string. This tool lets you test regexes right in the browser: type a test subject and a pattern, and every match is highlighted live below, with its position and capture groups listed. Add a replacement string to preview the result. A built-in library of email, URL, IPv4, mobile, ID-card, date and number patterns is one click away.

Example

Subject:

Contact [email protected] or [email protected], phone 13800138000.

Pattern [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,} with g enabled highlights both email addresses.

Common flags

  • g global (this tool highlights all matches by default)
  • i case-insensitive
  • m multiline (^ $ match line boundaries)
  • s dot matches newlines
  • u Unicode mode
  • y sticky match

Everything runs in your browser and works offline.

FAQ

Q1.Why are some matches not highlighted?
Without `g`, a regex matches only the first occurrence. This tool forces global matching to highlight everything; if your pattern has a syntax error, you will see an error message instead of results.
Q2.What does $1 mean in the replacement?
`$1`, `$2` refer to capture groups 1 and 2, `$&` is the whole match, and `$`/`$'` are the text before/after the match. Use them to reorder or wrap content.
Q3.Is my text uploaded?
No. Matching and replacement happen entirely in JavaScript inside your browser. Nothing carries your text over the network, and it works offline.
Q4.Which syntax is supported?
It matches the browser's built-in ECMAScript RegExp engine, including modern features like named capture groups `(?<name>…)`.
Advertisement

Related tools