Regular Expression
/ /
Test String
Match Results
0 matches 0 groups
Match Details

Matches will appear here...

Quick Reference
.Any character
\dDigit [0-9]
\wWord char [a-zA-Z0-9_]
\sWhitespace
^Start of string
$End of string
*0 or more
+1 or more
?0 or 1
{n,m}n to m times
[abc]Character class
(abc)Capture group
a|ba or b

How to Use the Regex Tester

Type a pattern, choose your flags, and paste the text you want to search. Matches are highlighted as you type, and any capture groups are listed underneath so you can check exactly what each part of the pattern picked up.

The tester uses JavaScript's regular expression engine, the same one in every modern browser and in Node.js. Most syntax is shared with Python, PHP (PCRE) and Java, but a few features differ, such as lookbehind support in older engines and named group syntax. If a pattern is going into another language, test the edge cases there too.

Flags explained

  • g (global): find every match, not just the first.
  • i (ignore case): treat upper and lower case as the same.
  • m (multiline): make ^ and $ match at the start and end of each line.
  • s (dotall): let . match line breaks as well.
  • u (unicode): handle emoji and other characters outside the basic range correctly.

Patterns people often need

  • UK postcode (rough check): ^[A-Z]{1,2}\d[A-Z\d]? ?\d[A-Z]{2}$ with the i flag
  • Digits only: ^\d+$
  • Trim spaces from the ends of a line: ^\s+|\s+$

Frequently asked questions

Which regex flavour does this use?

JavaScript (ECMAScript). It supports lookahead, lookbehind, named groups and the u and s flags. Syntax is close to PCRE, Python and Java, but not identical, so test edge cases in your target language.

Is my text sent anywhere?

No. The pattern and text are processed in your browser, so nothing you paste is uploaded.

Why does my pattern only find one match?

Without the g (global) flag, a regular expression stops at the first match. Turn on g to see them all.

Related tools

All Developer & Web tools