我有下面的数据,我只想从中检索消息男孩部分,并删除与“转发”标题相关的所有信息。
Â
---------------------- Forwarded by Phillip K Allen/HOU/ECT on 03/21/2000
01:24 PM ---------------------------
Â
Â
Stephane Brodeur
03/16/2000 07:06 AM
To: Phillip K Allen/HOU/ECT@ECT
cc:Â
Subject: Maps
Â
As requested by John, here's the map and the forecast...
Call me if you have any questions (403) 974-6756.
Â
到目前为止,我尝试的是正则表达式。
Â
matchebjj=re。搜索(r'(--.*主题:',tmp_文本,re。多特尔)
当我使用下面的命令打印时
print( tmp_text[matchObjj.span()[1]:])
我的产量不足。
Maps
Â
As requested by John, here's the map and the forecast...
Call me if you have any questions (403) 974-6756.
所以基本上,问题是正则表达式并没有剥离主题的完整行,只有标题主题被删除,但实际的主题文本仍然存在,在本例中是Maps。
Â
我希望正则表达式检测文本,直到主题行结束,然后删除它。请分享你的想法。Â