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\.-]
?
CodePudding user response:
[\w.-]
matches either a word character (\w
), a dash (-
) or a dot (.
). This is called a character class.