111 · Developer Tools

Regex Tester

Write a pattern and some test text to see every match highlighted, with capture groups in a table.

Regex Tester

Flags: g (all matches), i (ignore case), m (multiline), s (dot matches newline), u (Unicode), y (sticky).

Matches

Use $1, $2… for groups and $& for the whole match.

How to use the regex tester

  1. Type your pattern between the slashes and set flags, such as g or i.
  2. Paste the text to test.
  3. Check the highlighted matches and groups, and try a replacement.

Quick reference

  • \d digit, \w letter, digit or underscore, \s whitespace, . any character
  • + one or more, * zero or more, ? optional, {2,5} 2 to 5 times
  • ^ start, $ end, \b word boundary
  • (…) capture group, (?:…) non-capturing, (?<name>…) named group

Patterns run in a separate worker and are stopped after 2 seconds, so a pattern that backtracks catastrophically can’t freeze the page.

Examples

/\d{3}-\d{4}/g on “call 555-1234”

1 match: 555-1234

/(\w+)@(\w+)\.com/g, replace with “$1 at $2”

“ana at example”

Questions

Which regex flavour is this?

JavaScript (ECMAScript). Most syntax matches PCRE and Python, but lookbehind and some escapes differ slightly between languages.

Is my data uploaded?

No. Everything runs in your browser, so what you paste never leaves your device.