The new AppleScript support has made it practical to import several long, meandering chains of emails into Tinderbox where I’m trying to organize and analyze them.
I’ve run into a snag trying to “chop off” the extraneous bits and keep just the text of each message, not the text of messages to which each message replies.
For example the text imports as something like this:
Dear Bill, I thank you for your message; it provided many insights. Second paragraph of the current message that want to preserve. Sent from my iPhone On May 17, 2019, at 3:26 PM, william flintstone <email@example.com> wrote: Text of previous message(s) in chain that want to remove.
I want to keep the part up to the On … wrote:
I thought this might do it:
$Text=$Text.split("^On .*> wrote:$").at(0)
That works in some cases but in this case chops off at the semicolon after the word message. I have a tough time with regex but assume this may have something to do multi-line mode or some such thing.
How can I accomplish this in Tinderbox?