Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents


Note
  • Use of .* can lead to a massive computational load that the regexp engine has to evaluate.  Compound use of .* can result in insanely massive volume that translate to what appears to be a hung mail process whilst the several billion possibilities are tested.

Tip
  • Use static data range parameters e.g. [0-9]+ which limits the number of possibilities that can apply.

  • Use \n when looking for a word at the beginning of a line in order to limit the number of possible matches.

Background

When users reply to emails generated by JIRA the replied-to content is prefixed with an attribution line who's format is completely non-standard and is subject to language, locale and OS variations.  This means there is no single solution for every case an a per scenario solution has to be crafted. JEMH enables the configuration of expressions that match individual attribution styles: a worked example is below.

Worked Example

Preparing content

To obtain the content you will need to construct your expression copy a comment that has the replied-to content and paste into JEMH's Regexp Tester. Here you can write and test your expressions against the comment content to ensure you cut the information you want to.

Example data

When commenting on an issue via email the reply-to content of the email can also be included in the actual comment that is posted on an issue.  This can be removed through: JEMH > Profile > Email : Comment Only > Project Mapping > Pre-Processing : Body Delimiter Regexps.

Below is an example of a comment that is posting the replied-to content in the comment.

No Formatcode
== Created by JEMH via e-mail from: "Test User" <test@example.com> == 

Hi Admin

The issue still persists.

- Test User


    On Monday, August 20, 2016 1:35 PM, "admin@example.com" <admin@example.com> wrote:

	Hi Test

	Try disabling that feature and see what happens when you re run it.

	- Admin

...

The first step is to detect which line the replied-to content begins on, in this case the line begins with "On" so this can be detected with:

No Formatcode
On

 

However the word "On"  can be detected anywhere within the comment and so needs to be more specific. We use \nto detect that the we are searching for word is at the beginning of a new line and use \s*to check for any white space between the beginning of the line and the first word.  The *means Zero or more times of the preceding character (white space here), the example above has 4.

...

The from address part of the line is:

No Formatcode
"admin@example.com" <admin@example.com> wrote:

...