Regex Tester

Enter a JavaScript regular expression, choose flags and paste test text. Matches are highlighted, counted and listed with their capture groups.

Regex TesterRuns in your browser

Common flags: g (all matches), i (ignore case), m (multiline), s (dot matches newline), u (Unicode).

Highlighted matches

Your input stays in your browser and is not sent to a server by this page.

What it is and when to use it

A regular expression is a compact pattern for finding, validating or extracting text. This tester uses the JavaScript regular expression engine of your browser, so the results match what RegExp, String.match and String.replace do in your own code.

How to use

  1. Type a pattern without the surrounding slashes.
  2. Set flags, for example gi.
  3. Paste your test text; results update as you type.
  4. Read the highlighted matches and the group table below.

Example

Input
Pattern: [\w.+-]+@[\w-]+\.[\w.]+  Flags: gi
Result
Matches: hello@example.com, support@ilovedev.org

Tips and common mistakes

Frequently asked questions

Which regex flavor does it use?

The JavaScript engine of your own browser, so results match what JavaScript code in that browser would produce.

What happens with slow patterns?

Tests run in a background worker and are stopped after 2 seconds. This limits the harm from catastrophic backtracking, but it cannot predict every slow pattern in advance.

Are there limits?

Test text is limited to 200,000 characters and the first 1,000 matches are shown.

Related tools