fork download
  1. import re
  2. p = re.compile(r'(?<=>)(?:mailto:)?([a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9.-]+)(?=<)')
  3. test_str = "<b>dont:example@example.com</b>\n<b>mailto:match@example.com</b>\n<b>match@example.com</b>"
  4. print [x.group(1) for x in re.finditer(p, test_str)]
Success #stdin #stdout 0.01s 7736KB
stdin
Standard input is empty
stdout
['match@example.com', 'match@example.com']