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 underscores
  • g (flag) Find all matches, not just the first

No matches yet.

Everything runs in your browser, and your data never leaves your device.

TokenMeaningExample
.Any single character, except a line breakh.t matches hat, hot and h8t
\d\DAny digit from 0 to 9. \D is any character that is not a digit\d\d:\d\d matches 09:30
\w\WAny letter, digit or underscore. \W is any other character\w+ matches user_42
\s\SAny space, tab or line break. \S is any other characterhello\sworld matches hello world
[abc]Any one character listed in the brackets. [a-z] means a to zgr[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 1colou?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|bEither the part on the left or the part on the rightcat|dog matches cat or dog
\bWord boundary. The spot where a word starts or ends\bart\b matches art but not start