Extract email sub-strings from large document

前端 未结 11 2245
星月不相逢
星月不相逢 2020-11-28 06:54

I have a very large .txt file with hundreds of thousands of email addresses scattered throughout. They all take the format:

......
         


        
11条回答
  •  余生分开走
    2020-11-28 07:05

    import re
    rgx = r'(?:\.?)([\w\-_+#~!$&\'\.]+(?

    Please don't hate me for having a go at this infamous regex. The regex works for a decent portion of email addresses shown below. I mostly used this as my basis for the valid chars in an email address.

    Feel free to play around with it here

    I also made a variation where the regex captures emails like name at example.com

    (?:\.?)([\w\-_+#~!$&\'\.]+(?

提交回复
热议问题