Skip to content

Developer tools

Regex Tester

Write a regular expression and watch the matches light up in your test text. See every capture group and preview replacements.

/

Test text

Matches

Capture groups

#MatchGroups

        

How to use the Regex Tester

  1. 1

    Type the pattern (without slashes) and pick the flags.

  2. 2

    Paste the text to test; matches are highlighted as you type.

  3. 3

    Check the capture groups, and fill in "Replace with" to preview a replacement ($1, $<name>).

Frequently asked questions

Which regex flavour is this?

JavaScript (ECMAScript). Most patterns work the same in PHP's preg_* functions; differences include lookbehind support in older engines and named-group syntax.

Why does it say the pattern took too long?

Some patterns, such as nested quantifiers like (a+)+, can take exponential time on certain input ("catastrophic backtracking"). The tester stops after a second so the page stays usable.

Embed this tool on your site

Paste this code into your page. It's free, with no sign-up, ads or cookies.

Preview

Please keep the "Powered by Dev-Talk" link.

Get new articles in your inbox

Practical tutorials and deep dives, about once a week. No spam, unsubscribe anytime.

Privacy policy

Add DEV Talk to your Home Screen

  1. 1 Tap the Share button in Safari's toolbar.
  2. 2 Scroll down and tap Add to Home Screen.
  3. 3 Tap Add. Open it from the Home Screen to read like an app and to turn on notifications with the bell.

We use cookies to improve your experience and analyze traffic. By continuing, you agree to our Privacy Policy.