Can the JIRA Incoming Mail Handler that uses regex parse HTML/XML tags?

Ryan Thavaradhara August 11, 2017

For instance, if I want to split on the 5th <div> tag, is that possible, or is the markup already processed by the time the text hits the regex filter?

1 answer

0 votes
Thor
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 12, 2017

* What regex filter are you talking about?

* In a message handler you can extract the mail body like this:

MailUtils.getBody(message)

Afterwards you can do with the body whatever you want, also parse it with a regex. 

Ryan Thavaradhara August 14, 2017

Thanks for replying!  

The regex filter I refer to is a type of "Mail Handler" which can be found in the "Incoming Mail" administrative options when one is logged in as an administrator on JIRA.

This feature allows you set designate mail servers and set up mail handlers which are events that are performed when a designated server receives mail.

You choose the handler from a designated list of handler types, one of which allows you to parse the email with regex.

regexhandler.png 

I'm trying to set up JIRA to allow email replies to push straight to new issues/comments--but JIRA tends to dump the *entire* email, signature and all, into the comment.

I've looked at the underlying HTML in the emails and the only real places where I can consistently "split" the body content from the signature/reply chain/etc. is within <tags> and not the content inside of the tags--which I believe is the only thing that the regex works against in this scenario.

Thor
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 14, 2017

Your welcome.

May I ask what REGEX you used when it didn't find anything?

It would also be interesting to see how the mails are structured that you used for your tests so far.

Have you tried plain and HTML mails and if so, is there any difference in the result?

If your users of this mail handler know about it you can instead of using a tag also use an own identifier / keyword. A REGEX can basically be used to filter everything from simple to complex.

You can test REGEXes (e.g. with this site https://www.freeformatter.com/java-regex-tester.html) to create one that matches your needs.

Suggest an answer

Log in or Sign up to answer