How to test a pattern
Enter the pattern without surrounding slashes, choose flags and paste the text you want to search. Every match is highlighted in the text, and the list below shows where each match starts and what each group captured.
Handy building blocks
\da digit,\wa letter, digit or underscore,\sa space or tab.+one or more,*zero or more,?optional,{2,4}two to four.^start and$end of the text or line.(...)a group you can reuse,(?:...)a group you do not capture.
Cleaning text afterwards? Try remove duplicate lines or compare two versions with the diff checker.
Frequently asked questions
Which regex flavour does this use?
JavaScript, because it runs the regular expression engine in your browser. Most everyday patterns behave the same in Python, PHP and Java, but features like lookbehind or named groups can differ between languages.
What do the flags mean?
g finds every match instead of the first, i ignores upper or lower case, m lets ^ and $ match at each line, s lets the dot match a newline, and u turns on full Unicode support.
Why does it say the pattern took too long?
Some patterns, such as (a+)+ on a long string of a's, make the engine try an enormous number of paths. The tester stops after 1.5 seconds so your page never freezes. Rewrite the pattern to avoid nested repeats.
How do I use groups in the replacement?
Wrap part of the pattern in brackets, then write $1 for the first group, $2 for the second and so on. $& inserts the whole match.
Is my text uploaded?
No. The pattern and text stay in your browser.