How to test a regular expression
- Enter your regex in the pattern box (no slashes needed).
- Set the flags.
- Paste the text you want to test against.
- Check the highlights and the match list.
See your matches as you type
Regular expressions are much easier to get right when you can see what they match. Type a pattern, paste some test text, and every match lights up as you type.
Below that you get each match with its position and any capture groups. Turn the g, i, m and s flags on and off with a click. If you don't want to write a pattern from scratch, there are starters for emails, URLs, phone numbers, IP addresses, dates and hex colors.
Frequently asked questions
Which regex flavor is this?
JavaScript's. Most things carry over to Python, PHP and the rest, but some features (like certain lookbehinds and named group syntax) differ slightly between languages.
Can I use the email pattern for real validation?
It's fine for pulling emails out of text. For checking a sign-up form, a simple pattern plus actually sending a confirmation email is the only check that really works.