Regex not working when trying to remove the signature from incoming mails through the mail handler

Jan Segers July 20, 2016

Hello,

i would like to get rid of those annoying mail signatures when our employees comment on a ticket via mail. Our format is sth like this:

The actual comment
 
*Firstname Lastname* 
 
<the signature>

I want to chop of everything after the comment, so the firstname / lastname part and everything that follows.

I have build the following RegEx and verified that it is working in a text editor supporting regex:

\*.+\s.+\*

However, when i configure a new mail handler via "Add a comment before a specified marker or separator in the email body" and using this regex, the signatures are not touched at all. Obviously I also tried it with the slash delimited, changing it to this:

/\*.+\s.+\*/

But this does also not work at all.

Could it be the issue that our mails are HTML mails and that the regex is applied before the mail is converted to text so that it can be added as comment?

1 answer

0 votes
Edward Tew August 2, 2016

I have been having a similar problem recently and have been using the debug email logs and http://regexr.com/

to validate the regex in the incoming mail handler.

 

There seems to be an 80 char limit in the regex though.

We mainly use Outlook but there are a number of iOS and Android phone users that don't match the pattern.

 

 

Jan Segers August 2, 2016

So are you in the same boat as me or did you manage to solve this issue? I tried different variations but gave up eventually.

Edward Tew August 3, 2016

yep, 

I currently have 

  • Split Regex: /(\(JIRA\).(w|W)rote)|((O|o)r.*l.(M|m)e.*e.*)|((F|f)rom: jira-marin.*)|(___)/

to try and catch replies to JIRA sent messages

Linux mail appends : On <date> (JIRA) Wrote

Outlook Text emails appends : "Original Message" or "Original message"

Some androids use: From: jira-marin.... (our JIRA email account)

Some people include a line break in their signatures: ____

 

This regex string complains if I add any more characters to it. The error flashes up briefly when I click save and states that it cannot be more than 255 characters but it actually means 80.

 

 

 

Suggest an answer

Log in or Sign up to answer