Regex Tester

Build and test regular expressions with live inline highlighting, capture group breakdown, and replace mode.

How to test a regular expression

  1. Type your pattern and toggle the flags you need: global (g), case-insensitive (i), multiline (m), dotAll (s), Unicode (u), or match indices (d).
  2. Paste test text. Matches are highlighted as you type, and each one is listed with its position and capture groups, including named groups.
  3. Switch to Replace mode to try a substitution with $1,
    lt;name>
    , and other tokens.
  4. Open the railroad diagram to see the pattern's structure drawn out.

Start from a proven pattern

The pattern library has more than 50 common regexes, for emails, URLs, IPv4 and IPv6 addresses, dates and times, UUIDs, credit card formats, semantic versions, and more, each with notes on what it does and doesn't match. Load one, then adapt it to your data. The quick reference covers anchors, character classes, quantifiers, groups, and lookarounds.

Frequently asked questions

Which regex flavor does this use?

JavaScript's, the same engine as your browser and Node.js. Most syntax also works in Python, Java, and PCRE, but features like possessive quantifiers and some lookbehind rules differ.

Is my test text sent anywhere?

No. Matching runs in your browser, so you can test against real log lines and data safely.

Why does my regex only find one match?

Without the g flag, JavaScript stops at the first match. The tool warns you when it's off. For bulk find-and-replace on a document, try Text Utilities.

Related tools

More in Text & Code Tools · All 73 tools