【发布时间】:2021-08-06 02:30:41
【问题描述】:
我正在尝试使用 python 来提取sentence that contains the email。
sample_str = "This is a random sentence. This one is also random sentence but it contains an email address ---@---.com"
我看到的所有示例都提取了电子邮件,例如:
import re
lst = re.findall('\S+@\S+', sample_str)
但是无论如何要提取sentence that contains the email。在这种情况下
op = "This one is also random sentence but it contains an email address ---@---.com"
【问题讨论】:
标签: regex string regex-lookarounds regex-group