Im wondering if anyone could help me construct a regular expression to get rid of the following signature

The Name will change along with the job title, im unable to contruct one after a few hours of googling.

<Text i want to keep>

<Blah blah>

Brian Mitchell
System Administrator

Main Tel: +44 (0)1249 705 450 Mobile: +44 (0) 7854 136 496
DDI: +44 (0)1249 705 495
data analysis that delivers

3 answers

1 accepted

1 vote
Accepted answer

Whos the daddy?

(([A-Za-z ]*[\s\n]*){2}Main Tel:.*\nDDI:.*\n\nEmail:.*)

Wow very impressive, and im extremly gratefulll dude. i spent hours trying to wrap my head around reg ex and was not getting anywhere.

Now im hugely appreciative of what you have done but it when putting it through the regex tester in the JEMH config it missis out the website and the tag line as the screenshot shows, anychance these can be removed aswell?

<<I cant seem to add a image, it shows in the preview but when i save the comment it removes its self>>

The trailing .* in the above matches 'everything' after the preceeding regex, so will include the website as well, the purpose of the previous DDI/Email lines is to reduce chances of false positives (still possible, if rarely).

Regarding the inbuilt regexp tester, yes, there is a trick, top right corner of regexp tester page there is a checkbox, dot matches all, do that, this then matches what the server side Java stuff does.

It worked for me, I did test it. Perhaps your email content is not exaclty what is posted above? If you like, create a private JEMH Jira issue and attach a JEMH Test Case that came from a live email. There are always nuances, perhaps \r\n instead of \n...

Also i just tried to add this into the profile and its already containing a regex, seperating it with a comma doesnt work.

How can i combine the two to work together?

[\n]--[| ][\n],\nFrom:.*\nSent:.*\nTo:.*\nSubject:.*\n,(([A-Za-z ]*[\s\n]*){2}Main Tel:.*\nDDI:.*\n\nEmail:.*)

Andy your product is awesome and your support is even better, thank you very much for helping.

No i have a problem because our company is split into two very different groups we have linux users who mainly use Plain text email which is fine and the regex seems to be working and doing a good job of getting rid of the gunk but our windows users are using outlook and send email using HTML and the signature is not getting removed.

Is there a setting in the JEMH that i overlooked to get help us in this problem.

You haven't overlooked anything, its just a new email format, so you have to get another regexp for it. You need the text output from the HTML conversion to test your regexp against:

Take one inbound email from your JEMH audit screen, click 'Convert to Test Case', then re-run until your regep achives the required result for the post-HTML processing. If you're still stuck, feel free to create an issue on JEMH with an attached Test Case, I'll see if I can spot the difference.

Also, and if your collegues are sending HTML mail, I wonder if they have those snazzy embedded sig images? Use JEMH Global blacklist, upload one of those images and the md5 hash will forever block that particular image from being attached.

Andy, i have raised the following issue JEMH-988, and i was unsure how to attach a test case as you describe as i couldnt export it.

i was unable to createa test case and attach it to the ticket, so i just copied the text from my test case and placed it as a comment, please let me know if this is ok, if not please let me know the correct way to do it.


This is the image

This is the Image

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Feb 07, 2019 in Marketplace Apps

A Timeless Love Story

It started as any story starts, on a normal, rainy day.   Admin meets App, and her name was Klok2, and like any first relationship we were both trying to make it work but neither one knew what...

457 views 8 27
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you