Reg exps, they’ve always been my favs

Today I had a busy/kind of caotic day at work, not much of coding, just preparing excel files out of the SQL Server tables to hand to a translation team. It was soo time consuming and all I wanted was to get back to programming.
Anyways, feeling a little bit frustrated today, I arrived home and remembered I had this job a friend wanted me to do to filter some footers from email messages, I had to remove the original messages from the text.

My target phrases would be like the following ones:

On Tue, 2 Aug 2005 16:14:10 -0500 "Eric Marr"
<northland@charterinteret.cam> writes:

--- <fe.sola@infom.cu> wrote:

On 8/1/05, Belayer via sql-l
<sql-l@groups.ittoolbo.cem> wrote:

So it definetely cried out for regular expressions.
I downloaded the best tool for testing reg exps.
The freeware Regex Coach
My thumbs up for this tool,
I'll donate some money to it as soon I as clean up my CC, heh.

I came up with some reg exps that needs some extra tuning,
they are here on this text file
(Blogger complains of script injection, hehe)
Text file with RegExps

The php function for the final clean up
might come in a following post.
Cheers,
PG



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.