Free developer tool

Regex Tester

Enter a pattern, flags and test text. The tester lists every match with its position and capture groups so you can debug a regular expression quickly.

What is regex tester?

Regular expressions describe patterns in text, such as emails, dates or IDs. They are powerful and easy to get wrong, so testing against sample text saves time.

This tester uses the JavaScript regex engine in your browser. It shows each match, where it starts and what each capture group caught.

How to use the regex tester

  1. Type the pattern without slashes.
  2. Add flags such as g for all matches, i to ignore case and m for multiline.
  3. Paste your test text and read the matches.

How the regex tester works

The tool builds a RegExp object from your pattern and flags and runs it across the text, collecting up to 200 matches.

Worked example

The pattern \d+ with flag g on the text 12 apples and 7 pears finds 12 and 7.

Common uses of the regex tester

  • Building a pattern to validate emails, dates or IDs.
  • Finding and replacing text in an editor with a safe pattern.
  • Extracting data from logs and exports.
  • Learning regular expression syntax with instant feedback.
  • Debugging why a pattern matches too much or too little.

Tips and common mistakes

Start simple and build up. Add one part of the pattern at a time.

Use anchors and word boundaries to avoid matching more than you intend.

Background: what to know before you rely on it

Regular expressions were invented by mathematician Stephen Kleene in the 1950s and entered programming through Unix tools in the 1970s. They are compact but can be cryptic. Greedy patterns match as much as possible, so adding a question mark makes them lazy. Anchors such as caret and dollar fix a match to the start or end of a line. Capture groups pull out parts of a match. A badly written pattern can take exponential time on some inputs, a problem called catastrophic backtracking, so test with long strings. For complex formats such as HTML or full email rules, a proper parser is often a better tool.

Private, free and fast

This tool runs entirely in your browser. What you type or choose is not uploaded to a server and is not saved after you close the page, which keeps it fast and private. It is free to use as often as you like. See more in all developer tools, or browse the full list of tools.

Frequently asked questions

What do the flags mean?

g is global, i ignores case, m is multiline, s lets the dot match new lines and u enables Unicode.

Why does my pattern not match?

Check escaping. Backslashes need care in JavaScript strings but not in this box.

Does it support PCRE or Python?

No. It uses the JavaScript engine.

Related tools

Results are for information and education. For legal, financial, medical or security decisions, check with a qualified professional. Do not paste live secrets into any website.