solution:[a-zA-Z0-9.!#$%&'*+-/=?\^_`{|}~-][email protected][a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)* is a good choice
我使用正則表達式如下面的在文件中匹配的電子郵件地址的快速匹配的電子郵件正則表達式:查找
email = re.search('(\w+-*[.|\w]*)*@(\w+[.])*\w+',line)
當類似下面的文件中使用,我的正則表達式的作品好:
[email protected] huofenggib wrong in get_gsid
[email protected] rouni816161 wrong in get_gsid
但是當我使用它象下面這樣的文件,我的正則表達式運行不可接受緩緩道:
9b871484d3af90c89f375e3f3fb47c41e9ff22 [email protected]
e9b845f2fd3b49d4de775cb87bcf29cc40b72529e [email protected]
而當我使用從this website正則表達式,它仍然運行非常緩慢。
我需要一個解決方案,並想知道什麼是錯的。
定義 「慢」。你確定這是正常表達是瓶頸嗎? –
這是我的代碼http://pastebin.com/6vUBxLZV你可以試試它,當它運行時,它會停滯在正則表達式匹配中。 – young001