Regex Tester

Test regular expressions against sample text with live match highlighting.

//gi
2Matches
Contact: alice@example.com, bob@test.com
#IndexMatchGroups
19alice@example.com
$1: alice
$2: example
228bob@test.com
$1: bob
$2: test

About this tool

Write a regular expression, paste some test text and see every match highlighted instantly, with the index and capture groups for each one. Toggle the ignore-case, multiline, dotAll and unicode flags. The tester uses JavaScript's own regex engine, so results match what you will get in your code.

How to use it

  1. Type your pattern between the slashes.
  2. Choose flags and paste your test string.
  3. Review the highlighted text and the table of matches and groups.

Frequently asked questions

Which regex flavor does this use?

JavaScript (ECMAScript). Other languages are very similar for basics but differ in features such as lookbehind and named groups.

Why is the global flag always on?

So that every match is listed. A pattern without g would only show the first match.

Can a pattern freeze the page?

Badly written patterns can be very slow on long text (catastrophic backtracking). Simplify nested quantifiers like (a+)+ if that happens.