Regex tester

Write a pattern and see every match highlighted as you type, with a table of capture groups and a live preview of search and replace.

Private: works in your browser, nothing is uploaded.

How to use the Regex Tester tool

  1. Enter the pattern without the surrounding slashes.
  2. Tick the flags you need and paste your test text.
  3. Check the highlighted matches and groups. Fill in “Replace with” to preview a replacement.

Flags

  • g (global): find all matches, not just the first.
  • i: ignore upper and lower case.
  • m (multiline): ^ and $ match at every line start and end.
  • s (dotAll): the dot also matches newlines.
  • u (unicode): full Unicode support, including \p{L} letter classes and emoji.

Patterns worth knowing

  • ^\d{4}-\d{2}-\d{2}$: a date like 2026-10-12.
  • \b\d{1,3}(?:\.\d{1,3}){3}\b: something that looks like an IPv4 address.
  • (?<user>[^@\s]+)@(?<domain>[^@\s]+): a simple email split with named groups.
  • \s+$ with the m flag: trailing whitespace on every line.

A word of advice from log parsing: do not try to validate emails or URLs perfectly with one regex. Match loosely, then validate with a real parser or by sending a confirmation email.

Catastrophic backtracking

Some patterns, typically nested quantifiers like (a+)+$, take exponential time on certain inputs. In production this is a real denial-of-service risk (ReDoS) and has taken down large websites. The tester runs each pattern in a background worker and stops it after two seconds, so a bad pattern cannot freeze your browser, and you find out before it reaches your server.

Privacy

Everything runs in your browser. Nothing you type is sent to our server or stored.

Frequently asked questions

Which regex flavour is this?

JavaScript (ECMAScript), as used in browsers and Node.js. Most syntax is shared with Python, Java, .NET and PCRE, but lookbehind, named groups and Unicode classes differ slightly.

How do I use a group in the replacement?

Use $1, $2 for numbered groups, $ for named groups, and $& for the whole match.

Why does my pattern match an empty string?

Quantifiers like * allow zero characters. Use + to require at least one.

How do I match a literal dot or bracket?

Escape it with a backslash: \. \[ \( and so on.