Use Subject Issue Key Matching


JEMH searches email subjects for issue keys using one or more configurable regular expressions.  If a valid issue key is found, JEMH can associate the email with that issue and a comment will be attempted.  If no issue key is found in the subject, defined through a directive, or is present in the mail-thread, then a new issue may be created.


The regular expressions that are used can be defined under the setting Subject IssueKey (comment) Regexps found in the Email section of a JEMH profile.

To change the setting, click the edit icon in the Email section of the profile and scroll to the Subject IssueKey (comment) Regexps setting.

If removed or left untouched, matching occurs through the default regular expression (regexp):

1 \b[A-Z][A-Z_0-9]+-[0-9]+\b

Avoiding Subject Issue Key Mismatches

As an example, imagine an email is sent with the following subject:

Subject: Server is broken again, looks like INFRA-333 again

JEMH will use its configured regular expressions to try and match an issue key format.  If INFRA-333 is found to match an expression and be a valid issue key, a comment will be attempted on the issue.  This may be desirable in some cases, but what if JEMH is matching to issue keys that are not the intended target?

With a more specific regular expression, JEMH can more reliably determine what keys it should search for.  A simple way to do this is to use issue keys that are surrounded by some standard text.  Let's say that your Jira is producing notifications in this format:

1 [PStudio] (ABC-123) Bla bla bla bla

In order to match only this particular pattern and not any other issue key in the subject, the following regular expression could be used:

1 \[PStudio\]\s\(([A-Z]*-[0-9]*)\)

This will return issue key of format ABC-123 to JEMH only if they are in parentheses.  Any other issue keys found would be ignored as they do not match the expression.