I am trying to do a complicated (to me) regex on a multi-line snip from an e-mail. I have tried hard, with no luck. I am trying to get rid of anything from "On " through " wrote:"
Would be nice if you can also check to see if it contains the word "AcmeCompany", so it doesn't check for everything "On " "wrote:"
So far, I have this: /On(.*)AcmeCompany(.*)/im but it does not work...
say hello, world! On Tue, Jun 7, 2011 at 6:18 AM, AcmeCompany < [email protected]> wrote: Thank you for the responses, but it seems like there's another problem.
EDIT: I found out that this works: /On[\s\S]+?AcmeCompany[\s\S]+?wrote:/m, but it seems to fail when the e-mail contents have word "On".
say hello, world! On a plane! On Tue, Jun 7, 2011 at 6:18 AM, AcmeCompany < [email protected]> wrote: EDIT2: Every mail client is different... gmail tends to do it in 2 lines, mail app from iphone do it in 1 line, so it doens't always follow the strict format.
1 thing for sure: beginning always uses "On " and ends with " wrote:". It also contains a hash and AcmeCompany, which I can also use to verify.

.*, tryOn.*AcmeCompany.*.won't catch a newline, which is why you are having trouble with a regex that spans more than one line.On blah blah On Tues Jun 7,it breaks..