Project

General

Profile

Redmine incoming e-mails RegEx truncate question (allow 2 lines after Best Regards)

Added by T Pl over 2 years ago

Hi,

I want to streamline incoming e-mail to Redmine.

At the moment I am using;

--Please reply above this line--
^.*(Best regards|Sincerely,|Regards|Kind Regards|best wishes,|Thank you and kind regards,|Best wishes,|Best,|Many Thanks,|Cheers,|Thank you,|С уважением,|Met vriendelijke groet,|Hartelijke groet,|Met positieve groet,).*$

The first working as designed when the tag is present in the e-mail the rest is cutoff/truncated. So that is fine.
The second is meant to strip the signature because some companies have exhausting long signatures. It does it's job and even strips "Best Regards" and all that follows.
However I would like to have the first two lines of the signature imported.

So the regex I am looking for should;
- Look for the above strings in an email like "Best Regards"
- Cut off / truncate AFTER the next 2 lines following this string

So if for example the signature is;

My sad email text.

With kind regards,
Tom Watson
Phone: +32-57233290320
Company: Mycompany
disclaimer
blablablalbalba very long and boring disclaimer

Should add to redmine ticket;
My sad email text.

With kind regards,
Tom Watson
Phone: +32-57233290320

Is this possible? I have been trying for hours but cannot get it to work.

My last attempt is

^.*With kind regards,.*\R(.*\R){2}

But didn't work.
It does actually work in https://regex101.com but not in redmine.

Any suggestions?