Skip to content
DevTools

Regex Tester — Test JavaScript Regular Expressions

Test JavaScript regular expressions against sample text. See every match with its index, line, capture groups and named groups, and try replacements.

Test string

Output

Ready

Runs locally in your browser — your data is never uploaded.

About the Regex Tester

Test JavaScript regular expressions against your own text. Every match is listed with its position, line number, numbered capture groups and named groups, and you can preview a replacement using $1 or $<name> references.

Flags g, i, m, s, u, y and d are supported. Errors in the pattern are reported clearly, so you can fix them before putting the regex in your code.

How to use it

  1. Enter the pattern and flags.
  2. Paste the test text in the input.
  3. Optionally add a replacement string to preview the result.

Features

  • JavaScript (ECMAScript) regex engine
  • Capture and named groups
  • Replacement preview
  • Match index and line number

Frequently asked questions

Which regex flavour does it use?

Your browser's JavaScript engine. Syntax is very close to PCRE for common patterns, but lookbehind support, possessive quantifiers and some escapes differ from Python, Java or PHP.

How do I reference groups in the replacement?

Use $1, $2… for numbered groups, $<name> for named groups and $& for the whole match.

Is my data uploaded anywhere?

No. All processing happens in JavaScript inside your browser tab. Your input is never sent to a server, logged or stored, so it is safe to use with internal or sensitive data.