Free Regex Tester and Explainer
Type a regular expression and some text: every match and group is highlighted as you type, with a replace preview and each part of the pattern explained in plain words.
- Live matches and groups
- The pattern in plain English
- Free, runs in your browser
The pattern, piece by piece
| (?<user> | start of the group named "user" |
|---|---|
| [\w.+-]+ | one of \w.+-, one or more times |
| ) | end of the group |
| @ | the character "@" |
| (?<domain> | start of the group named "domain" |
| [\w-]+ | one of \w-, one or more times |
| \. | the character "." |
| [\w.]+ | one of \w., one or more times |
| ) | end of the group |
Matches
Building redirects or filters for a site move? See our SEO audit services
Regex Cheat Sheet
The pieces most patterns are built from. This tester uses JavaScript's regex engine, the one in every browser and Node.js.
- \d \w \s
- A digit, a word character (letter, digit or _), a space or line break. Capitals mean the opposite: \D is anything but a digit. MDN: Regular expressions
- . ^ $
- Any character except a line break; the start of the text; the end. With the m flag, ^ and $ match at each line.
- * + ? {2,5}
- Repeat: zero or more, one or more, optional, between 2 and 5 times. Add ? after any of them to match as little as possible.
- [abc] [^abc] [a-z]
- One of the characters listed, any character except them, or a range.
- ( ) (?: ) (?<name> )
- A captured group ($1 in a replace), a group that is not captured, and a named group ($<name>).
- a|b (?=x) (?!x)
- Either a or b; followed by x; not followed by x. Look-behinds (?<=x) and (?<!x) check what comes before.
How to Build and Test a Regex
Start small, test against real text, then tighten.
Paste real text
Use text with the matches you want and the ones you do not, so you see both.
Write the pattern a piece at a time
Check the plain-English table after each piece: it says exactly what each part matches.
Pick the flags
g to find every match, i to ignore case, m to work line by line.
Preview the replace
Use $1 or $<name> to reuse groups, and check the result before you run it on real data.
When You Want It Done for You
From one pattern to a whole site that works.
SEO audit services
Every technical issue on your site, speed included, with the fix and what it costs you.
OpenSEO services
The 90-Day Lead Engine: rank higher in 90 days or less, or we work free until you do.
OpenRegex Tester Questions
Which regex flavor does this use?
Why did my pattern stop with a timeout?
How do I match a dot or a bracket literally?
What is the difference between greedy and lazy?
How do I use groups in a replace?
Is my text sent anywhere?
Want a Site That Is Fast, Accessible and Built to Rank?
Tools fix one thing at a time. A free website plan covers the lot: the pages you need, a copy outline, a fixed price and a launch date, live in 14 days.
- The pages you need, and the one job each page does
- What your current site loses, in leads and money
- A fixed price and a 14-day launch date
- An honest answer on whether you need a new site at all
Rather talk it through? Call +1 (217) 677-5905