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\.-]?
Asked
Active
Viewed 31 times
0
ShadowRanger
- 143,180
- 12
- 188
- 271
Amin Zarandi
- 3
- 2
-
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 Answers
0
[\w.-] matches either a word character (\w), a dash (-) or a dot (.). This is called a character class.
MennoK
- 436
- 3
- 10