solution:[a-zA-Z0-9.!#$%&'*+-/=?\^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)* is a good choice
I am using a regular expression like the below to match email addresses in a file:
email = re.search('(\w+-*[.|\w]*)*@(\w+[.])*\w+',line)
When used on a file like the following, my regular expression works well:
[email protected] huofenggib wrong in get_gsid
[email protected] rouni816161 wrong in get_gsid
But when I use it on a file like below, my regular expression runs unacceptably slowly:
9b871484d3af90c89f375e3f3fb47c41e9ff22 [email protected]
e9b845f2fd3b49d4de775cb87bcf29cc40b72529e [email protected]
And when I use the regular expression from this website, it still runs very slowly.
I need a solution and want to know what's wrong.