Regex Tester

Test JavaScript regular expressions with live highlighting. Matches appear as you type. Toggle all six flags — g, i, m, s, u, y — independently. See index, full match and capture groups for every match. Clear error messages for malformed patterns.

How to use

1

Enter your regex

Type the pattern between the slashes or in the pattern field.

2

Toggle flags

Enable g, i, m, s, u or y as needed.

3

Paste your test text

Drop in the text you want to match against.

4

Review matches

See all matches highlighted, with index and capture groups listed below.

//g
2 matches
Test string
Highlighted matches
Contact us at hello@example.com or support@mycompany.org.
Invalid: not-an-email
Match details
#1Index: 14
Full match:hello@example.com
#2Index: 35
Full match:support@mycompany.org

Features

Live highlighting

Matches are highlighted in the test text as you type.

Match details

See the index, full match and capture groups for every match.

Six flags

g, i, m, s, u and y — toggle them independently.

Invalid pattern feedback

Clear error messages if the regex is malformed.

Common use cases

  • Debug a regex before adding it to code
  • Test a pattern against sample data
  • Check capture groups and match indices
  • Learn regex syntax with live feedback

Frequently Asked Questions

Related tools