Regex Tester

Test regular expressions against sample text.

FreeNo accountOn your device

Runs in your browser. How to verify

Loading tool…

About this tool

Enter a pattern and flags, paste your test text, and see every match listed one per line. It uses the JavaScript RegExp engine in your browser. Patterns that backtrack forever are stopped after two seconds instead of freezing the page.

How to use

1
Step 1
Type the pattern without slashes, for example \d+.
2
Step 2
Set the flags (g is the default; add i for case-insensitive).
3
Step 3
Paste the text to test and press Run.

How it works

The pattern is compiled with new RegExp(pattern, flags) in a background worker, with g always added, and run over the text with matchAll. Each full match is printed on its own line, up to 10,000 matches. If nothing matches the output reads No matches. An invalid pattern shows the engine's error message.

Worked example

Numbers in a sentence

Input
Pattern: \d+ Text: Order 1042 shipped; order 77 pending; ref A-9
Output
1042 77 9
Walkthrough
\d+ matches each run of digits. The 9 in A-9 is matched too.

Limitations

  • Only the full text of each match is shown. Capture groups, indexes and named groups are not displayed.
  • No replace or highlight view.
  • It follows JavaScript syntax; PCRE or Python-only features such as possessive quantifiers and inline flags may not work.
  • Stops after 2 seconds and at 10,000 matches.

Questions

How do I test a regex online?
Enter the pattern and flags, paste the sample text and press Run. Matches are listed below.
Which regex flavour does it use?
JavaScript (ECMAScript), the same engine as your browser.
Why do I see 'taking too long'?
The pattern likely has nested repeats like (a+)+ that backtrack catastrophically. Simplify it.
Does it show capture groups?
No, only the full match text for each hit.
How do I make it case-insensitive?
Put i in the flags field, for example gi.

Features

  • JavaScript RegExp
  • Flags field
  • 2-second safety timeout
  • Runs in your browser

Guides

Related resources

Guides and videos from around the web—opens on YouTube or the publisher’s site.

  • Inspect Network Activity - Chrome DevTools 101

    Chrome for Developers

    Debugging payloads you paste into JSON and JWT tools.

    Watch on YouTube
  • Learn Regular Expressions In 20 Minutes

    Web Dev Simplified

    Fast path through groups, quantifiers, and character classes.

    Watch on YouTube