Guides Favs 0

Home / Developer / Regex Tester

Regex Tester

Test a JavaScript regular expression against sample text, with live highlighting, capture groups and a replace preview.

//

Match details

#MatchIndexGroups
.any character\d \w \sdigit, word, space[abc]any of a, b, c[^abc]none of a, b, c ^ $start / end\bword boundary* + ?0+, 1+, 0 or 1{2,5}2 to 5 times (…)capture group(?<n>…)named group(?:…)non-capturinga|ba or b (?=…)lookahead(?<=…)lookbehindg i mglobal, ignore case, multilines u ydotAll, unicode, sticky

About the Regex Tester

The Regex Tester lets you write a JavaScript regular expression and see every match highlighted live in your test text, with the index and capture groups of each match listed in a table. A replace preview shows what a substitution would produce using $1, $2 and named groups. It is a fast way to build and debug patterns for validation, search and data extraction.

How to use the Regex Tester

  1. Type your regular expression between the slashes and set flags such as g, i or m.
  2. Paste the text you want to test against.
  3. See matches highlighted and listed with their index and groups.
  4. Enter a replacement to preview the result of a find-and-replace.

Frequently asked questions

What regex flavour does this tester use?

It uses the JavaScript (ECMAScript) regular expression engine built into your browser, so results match what you get in JavaScript and Node.js.

What do the g, i and m flags do?

g finds all matches instead of just the first, i makes the match case-insensitive, and m makes ^ and $ match at the start and end of each line.

How do I use a capture group in the replacement?

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