Regex Tester

Test a regular expression against your own text, with matches highlighted live as you type.

Last updated

0Matches
—
No capture groups in this pattern, or no matches yet.
Copied

How to test a regular expression

  1. Type your pattern, for example \b[A-Z][a-z]+\b.
  2. Add flags such as g and i.
  3. Paste test text; matches are highlighted as you type and capture groups are listed below.

About this tool

This tester runs your pattern using JavaScript's native RegExp engine, so behaviour matches exactly what you'd get in browser JavaScript or Node.js — flavours like PCRE (used in PHP or many online tools) can differ slightly in edge cases. Common flags: g finds all matches instead of stopping at the first, i ignores case, m makes ^ and $ match line boundaries instead of just the start/end of the whole string, and s lets . match newlines.

Everything runs locally in your browser — the pattern and text you enter are never sent anywhere.

Questions about regular expressions

What do the regex flags mean?

g finds every match, i ignores case, m makes ^ and $ match at each line, s lets . match line breaks, and u turns on full Unicode support.

Which regex flavour does it use?

JavaScript’s, so results match browsers and Node.js. PCRE (PHP) and Python are very similar but differ in some details, such as lookbehind support and named group syntax.

How do I match an email address?

A simple pattern is [\w.+-]+@[\w-]+\.[\w.]+. Fully validating email addresses with regex is notoriously hard, so keep it simple and send a confirmation email.

What is a capture group?

Part of a pattern in brackets, such as (\d{4}), whose match is saved separately. Each group’s match is listed under the text.

☕ Support toolcrate