Extract email sub-strings from large document

前端 未结 11 2220
星月不相逢
星月不相逢 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:02

    import re
    
    reg_pat = r'\S+@\S+\.\S+'
    
    test_text = 'xyz.byc@cfg-jj.com    ir_er@cu.co.kl   uiufubvcbuw bvkw  ko@com    m@urice'   
    
    emails = re.findall(reg_pat ,test_text,re.IGNORECASE)
    print(emails)
    

    Output:

    ['xyz.byc@cfg-jj.com', 'ir_er@cu.co.kl']
    

提交回复
热议问题