Regex Tester

Test regular expressions live: highlighted matches, capture groups and replace.

//
g all matchesi ignore casem ^ $ per lines . matches newlineu Unicode
Highlighted
Matches and groups
#MatchIndexGroups

How to use Regex Tester

  1. Enter your regular expression and flags, or choose a common pattern.
  2. Paste the text you want to search – matches are highlighted instantly.
  3. Check the groups table, and type a replacement to preview the replaced text.

About this tool

Regular expressions are powerful but easy to get wrong. This regex tester shows the effect of every change as you type: matches are highlighted in your test text, a table lists each match with its position and capture groups (including named groups), and the match count updates live.

Toggle regex flags such as g (all matches), i (ignore case), m (multiline), s (dot matches newlines) and u (Unicode), and see a clear message if the pattern has a syntax error. Type a replacement using $1, $2 or $& to preview a find-and-replace before you run it in your code. A list of ready-made patterns for emails, URLs, IP addresses, phone numbers, dates and hex colours gives you a starting point. The regex tester uses your browser's JavaScript engine, which matches the syntax used by most languages for everyday patterns.

Frequently asked questions

JavaScript (ECMAScript). Everyday syntax – character classes, quantifiers, groups, lookahead and lookbehind – works the same in Python, PHP (PCRE), Java and .NET; a few advanced features differ.

Add the g (global) flag. Without it, a regular expression stops at the first match.

Wrap part of the pattern in parentheses and refer to it as $1, $2 and so on. Named groups (?<name>…) can be used as $<name>. $& inserts the whole match.

Escape it with a backslash: \. matches a dot and \( a bracket, because these characters have special meanings in a regular expression.