Developer & Web Tools

Regex Tester

Test regular expressions against sample text with live match highlighting and capture groups.

Privacy

Everything on this page runs inside your browser. Nothing you paste, type or upload is transmitted, logged or stored.

Tips

  • Without the g flag only the first match is returned. That is the single most common reason a pattern "does not work".
  • The m flag makes ^ and $ match at line boundaries rather than only at the start and end of the whole string.
  • This uses the JavaScript regex engine. PCRE, Python and Go differ in places — lookbehind support and named-group syntax in particular.
  • Nested quantifiers such as (a+)+ can trigger catastrophic backtracking on non-matching input. If a pattern hangs elsewhere, that is usually why.
  • In replace mode, $& is the whole match, $1 is the first group, and $<name> is a named group.

Frequently asked questions

Why does my pattern behave differently in my code?

Check the flags and the escaping. A pattern written in a string literal needs its backslashes doubled — \\d in JavaScript source is \d in the pattern. Entering it here directly avoids that layer.

Related tools