Test regular expressions in real-time with match highlighting and detailed results.
Matches will appear here...
. | Any character |
\d | Digit [0-9] |
\w | Word char [a-zA-Z0-9_] |
\s | Whitespace |
^ | 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|b | a or b |
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.
^ and $ match at the start and end of each line.. match line breaks as well.^[A-Z]{1,2}\d[A-Z\d]? ?\d[A-Z]{2}$ with the i flag^\d+$^\s+|\s+$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.
No. The pattern and text are processed in your browser, so nothing you paste is uploaded.
Without the g (global) flag, a regular expression stops at the first match. Turn on g to see them all.