0

I am writing a code to search for all the email addresses. I was wondering why I should write it as: '[\w \.-]+@[\w \.-]+' What does \.- do in [\w\.-]?

ShadowRanger
  • 143,180
  • 12
  • 188
  • 271
  • Does this answer your question? [Reference - What does this regex mean?](https://stackoverflow.com/questions/22937618/reference-what-does-this-regex-mean) – Ken White May 05 '22 at 02:14

1 Answers1

0

[\w.-] matches either a word character (\w), a dash (-) or a dot (.). This is called a character class.

MennoK
  • 436
  • 3
  • 10