Regex Tester
Test a regex and see every match live.
0 matches
Code: /[\w.-]+@[\w-]+\.\w+/g.exec(text)
[\w.-]+One or more of: a letter, a digit, "_", "." or "-"@The character "@"[\w-]+One or more of: a letter, a digit, "_" or "-"\.The character "."\w+One or more letters, digits or underscoresg(flag) Find all matches, not just the first
No matches yet.
Everything runs in your browser, and your data never leaves your device.
| Token | Meaning | Example |
|---|---|---|
. | Any single character, except a line break | h.t matches hat, hot and h8t |
\d\D | Any digit from 0 to 9. \D is any character that is not a digit | \d\d:\d\d matches 09:30 |
\w\W | Any letter, digit or underscore. \W is any other character | \w+ matches user_42 |
\s\S | Any space, tab or line break. \S is any other character | hello\sworld matches hello world |
[abc] | Any one character listed in the brackets. [a-z] means a to z | gr[ae]y matches gray and grey |
[^abc] | Any one character that is not inside the brackets | [^,]+ matches text up to the next comma |
*+? | How many times the part before it repeats: 0 or more, 1 or more, 0 or 1 | colou?r matches color and colour |
{n}{n,m} | Repeats the part before it exactly n times, or from n to m times | \d{2,4} matches 2 to 4 digits in a row |
^$ | Start and end of the text. With the m flag, start and end of each line | ^\d+$ matches text that is only digits |
(...) | Capture group. Saves what it matches, so you can use it as $1 in a replace | (\d+)px saves 12 from 12px |
(?:...) | Groups parts together without saving the match | (?:ha)+ matches ha and hahaha |
a|b | Either the part on the left or the part on the right | cat|dog matches cat or dog |
\b | Word boundary. The spot where a word starts or ends | \bart\b matches art but not start |