Jump to content

Helpdesk Email Regex Help


plzmakehelpregards

Recommended Posts

Hi,

 

I manage a PHP based support helpdesk; when staff reply to a ticket via the web interface, it sends the response in the form of an email to the customer. To respond, the customer can simply reply directly to the email and their response is automatically piped into the helpdesk and posted to the corresponding ticket via a mail parser function. The problem is that often customers keep the staff response intact in the bottom of the email; so it looks something like this:

 

=============================================

thanks for the help bob, I'll try your recommendation.

-Tom Fakeman

On Tuesday, April 1, 2014 at 2:00 AM, Fake Support Company.com wrote:

> Please try shooting the device multiple times with any available firearm; if that doesn't work please let us know.... Either

> way at least you will probably feel better :)

>
> Bob F.
> Senior Technician
> Fake Support Company.com

=============================================

 

Thus, when you email is parsed, everything is posted to the ticket, including "On Tuesday, April 1, 2014 at 2:00 AM, Fake Support Company.com wrote:" and everything under it..... Ideally only the following portion would be posted to the ticket:

 

=============================================

thanks for the help bob, I'll try your recommendation.

-Tom Fakeman

=============================================

 

With that said, the helpdesk does include a feature that allows me to specify a "breakline" regex specifically to take care of this, thus basically I need help constructing a regex string to match the "On Tuesday, April 1, 2014 at 2:00 AM, Fake Support Company.com wrote:" string; I have very little PHP development experience but I could probably stumble my way through making a fairly basic regex, however I'm afraid if its too basic it will match other lines and I will run into issues with false-positive breaklines.

 

If someone could assist me in creating an appropriate regex for this I'd greatly appreciate it.

 

EDIT: I'm not looking to freeload in anyway and thus I'll be more than happy to send a donation to whomever can get me a working regex and/or the phpfreaks.com site (via http://www.phpfreaks.com/page/donations ).

 

Thanks!

Edited by plzmakehelpregards
Link to comment
Share on other sites

The intro line won't always be in that format - different email clients and especially different (native) language clients may do it differently. Fortunately the > prefix is pretty standard so I would go about it as finding a line that doesn't start with a > then maybe blank lines then lines starting with >.

 

Couple expressions to try, which one works depends on the way the regex is being executed:

^[^>].*\s+>.*\s+>
[\r\n]+[^>][^\r\n]+[\r\n]+>[^\r\n]+[\r\n]+>
If neither work then it'd help to get specifics about what software you're using and ideally some documentation about what it supports for regular expressions.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.