Regex Tester
Try a regular expression on a text and see every match and group.
Your result will appear here
Fill in the details on the left and press the button. You will see the answer right here, without the page reloading.
About this tool
Test a regular expression against a text. Every match is listed with its position and capture groups, and you can preview a replacement. It uses PHP's PCRE engine, which is close to (but not identical with) JavaScript and Python regexes. Patterns that would take forever (catastrophic backtracking) are stopped safely and reported. Your text is processed for this request only and is never stored.
Frequently asked questions
Which regex flavour does the tester use?
It uses JavaScript regular expressions. Other languages share the basics but differ in some features, so test again in your own language.
Why does my pattern match too much?
Quantifiers such as * and + are greedy. Add a ? to make them lazy, or make the pattern more specific.
What do the flags do?
Flags change the matching, for example g finds all matches, i ignores letter case and m lets ^ and $ match at each line.