Test and debug regular expressions in real time. Matches highlight instantly as you type.
A regular expression - usually called a regex - is a sequence of characters that defines a search pattern. You use them to find, match, or replace text that follows a specific pattern. For example a regex can find all email addresses in a document, validate a phone number format, or extract all URLs from a web page.
Regex is supported in almost every programming language including JavaScript, Python, C#, Java, and PHP. The syntax varies slightly between languages but the core concepts are the same everywhere.
Type your regex pattern in the top input box. Paste your test string in the text area below. Matches highlight in yellow instantly as you type. The matches list below shows every match with its position in the string. Click any item in the quick reference to insert it into your pattern.
The g flag means global - find all matches, not just the first one. The i flag makes the match case insensitive. The m flag makes ^ and $ match the start and end of each line instead of the whole string. The s flag makes the dot character match newlines as well.
Common reasons include forgetting to escape special characters like dots and brackets, using the wrong flags, or a pattern that is more specific than you think. Try simplifying the pattern and building it up step by step to find where it breaks.
This tester uses JavaScript regex which is ECMAScript standard. It is very similar to most other languages but has some differences from PCRE which is used in PHP, Python, and others.
Yes. A common email regex is [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}. Paste it into the pattern box and test your email addresses in the test string box.