Extract emails from html using regex

前端 未结 3 1031
无人共我
无人共我 2021-01-22 20:25

I\'m trying to extract any jabber accounts (emails) using regex from this page.

I\'ve tried using regex:

\\w+@[\\w.-]+|\\{(?:\\w+, *)+\\w+\\}@[\\w.-]+
         


        
3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-22 21:13

    This might work:

    [^\s@<>]+@[^\s@<>]+\.[^\s@<>]+

    p = re.compile(ur'[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+', re.MULTILINE | re.IGNORECASE)
    test_str = r'...'
    re.findall(p, test_str)
    

    See example.

提交回复
热议问题