Regex Tester

Test regular expressions with live match highlighting, groups, and replace
  • Files never leave your device
  • Runs in your browser
  • Free, no sign-up, no watermark
Matches will be listed here.

How to use Regex Tester

Test JavaScript regular expressions against your text with live highlighting, capture groups, and a replace preview. Each pattern is explained token by token, and the tool generates ready-to-run JavaScript. Matching runs in a background worker, so a runaway pattern stops instead of freezing the page.

  1. 1

    Type a pattern in Regular expression, or pick one from Common patterns. Pasting /pattern/flags fills in the flags too.

  2. 2

    Toggle the flags you need, such as g, i, m, or s.

  3. 3

    Paste your text into Test string. Matches are highlighted; hover one to see its groups.

  4. 4

    Use the Matches, Explanation, and Code tabs, or turn on Replace to preview the result of string.replace().

Frequently asked questions

Which regex flavor does it use?

JavaScript, the engine built into your browser. Flags g, i, m, s, u, y, d, and v are supported. Syntax specific to PCRE, Python, or Java may behave differently.

Why does it only find one match?

Without the g flag, JavaScript stops at the first match. Turn on g (global) to find them all.

What does "Stopped after 1.5 s" mean?

The pattern took too long on this text, usually from catastrophic backtracking with nested quantifiers like (a+)+. Make the inner parts more specific or anchor the pattern.

How do I use named groups in the replacement?

Write $<name> for a named group, $1 for a numbered one, and $& for the whole match. The buttons under Replace with insert these tokens.

Is my test text stored or uploaded?

Your text is never uploaded. The pattern, flags, and replacement are remembered in this browser; the test string is not.