I Have below data, from this I want to retrieve only the message boy part and remove all the info related to “Forward” header.
---------------------- 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.
What I have tried so far is below regular expression. matchObjj = re.search(r'(---.*?)Subject:', tmp_text, re.DOTALL)
When I print using below command
print( tmp_text[matchObjj.span()[1]:])
I get below output.
Maps
As requested by John, here's the map and the forecast...
Call me if you have any questions (403) 974-6756.
So basically the issue is that the regex is not stripping the complete line of “Subject:” and only the header Subject: is removed but the actual subject text is still there which in this case is “Maps”. I want the regex to detect the text till end of Subject line and then remove it. Please share your thoughts.