Home > OS >  In re module what does \.- do in [\w\.-] ?
In re module what does \.- do in [\w\.-] ?

Time:05-05

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.

  • Related