developers.do

Regex Tester

Test regular expressions with match highlighting, capture groups, and string replacement

Enter a pattern and test string to see matches highlighted inline. Switch to Replace mode to apply substitutions.

//g

Guide

About this regex tester

The regex tester runs patterns with the JavaScript RegExp engine and updates matches as you edit. It highlights matched text, reports match indexes and capture groups, and can preview replacement output without sending the test string anywhere.

How to use the regex tester

  1. 1.Enter a pattern without surrounding slash delimiters.
  2. 2.Enable the global, case-insensitive, multiline, or dotAll flags you need.
  3. 3.Paste a test string and inspect highlighted matches, capture groups, or replacement output.

Important details

Supported regular-expression flavor

Patterns use the JavaScript regular-expression syntax supported by your browser. A pattern copied from PCRE, Python, .NET, Java, or another engine may need changes because features and escaping rules differ between engines.

Flags and replacement behavior

The g flag finds every match; i ignores case; m changes the behavior of line anchors; and s allows a dot to match newline characters. Replacement syntax follows JavaScript String.replace conventions, including numbered capture references such as $1.

Frequently asked questions

Should I include / characters around the pattern?

No. Enter only the pattern body. Choose flags with the controls next to the pattern field.

Why does a regex work in another language but fail here?

Regular-expression engines are not identical. Check whether the pattern uses engine-specific groups, flags, escapes, or lookaround behavior.

References: MDN: JavaScript regular expressions