Regex Tester

Test regular expressions with live matching.

  • Runs in your browser
  • No signup
//

How to use Regex Tester

  1. Write a pattern

    Type a regular expression, or start from a preset such as email, URL, IP address or date.

  2. Set flags and test text

    Toggle g, i, m, s and u flags and paste the text to search.

  3. Inspect the matches

    Matches are highlighted live, with every capture group listed under each match.

How to test regular expressions online

Regular expressions are powerful but easy to get subtly wrong. Regex Tester highlights matches as you type, shows each capture group, and lets you toggle flags, so you can build and debug a pattern against real text before putting it in your code.

Flags explained

This tester uses JavaScript regular expressions, with these flags:

  • g (global): find all matches instead of stopping at the first.
  • i (ignore case): A and a match each other.
  • m (multiline): ^ and $ match at the start and end of each line.
  • s (dotall): . also matches line breaks.
  • u (unicode): treat the pattern and text as Unicode code points, needed for emoji and many scripts.

Handy building blocks

\d matches a digit, \w a word character, \s whitespace, and \b a word boundary. Quantifiers + (one or more), * (zero or more), ? (optional) and {2,4} (between two and four) control repetition. Parentheses create capture groups, and (?:...) groups without capturing.

From tester to code

Presets for email, URL, phone number, IP address, ISO dates, hex colors and HTML tags give you a starting point to adapt. When your pattern works, Find & Replace can apply it to a whole document, using $1 and $2 to reuse capture groups. Everything runs in your browser.

Regex Tester: frequently asked questions