Applying Body Regexes

Summary

Body Regexes allow you to remove content from the email that should not be added to the Issue Description or Comment. For example Signatures or Forwarded email prefix.

Body Delimiter expressions are always prefixed with a leading \n to reduce false positives. For performance reasons .* isn't allowed - use more specific patterns instead.

Pre Field Processor Body Clean-up

This features allows you to remove specific lines of content before the Field Processor has processed the email. This allows you to remove content that may interfere with the detection of directives.

In this example we are using the Pre Field Processor Body Clean-up Regex to strip out unwanted header data from an email we are forwarding. Here is what our incoming email looks like:

MIME-Version: 1.0 Received: by 10.223.112.12 with HTTP; Sat, 18 Jun 2011 22:42:26 -0700 (PDT) Date: Mon, 10 2015 2015 17:42:26 +1200 Subject: FW: This is forwarded From: ryan@thepluginpeople.com To: changeme@thiswontwork.com Content-Type: text/plain; charset=UTF-8 ---------- Forwarded message --------- From: Some User <someuser@testdomain.com> Date: Wed, Nov 24, 2015 at 14:16 AM Subject: Re: Some original subject line To: Our Agent <test@testdomain.com> Hello Support, This is a forwarded message.

To strip out the forwarded message header, we are using the following regex:

---------- Forwarded message ---------\nFrom: [A-Za-z<>@\. ]+\nDate: [A-Za-z]+\, (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) [1-9][0-9]{0,1}\, [0-9]{4} at [1-9][0-9]{0,1}:[0-9]{2} (AM|PM)\nSubject: Re: [A-Za-z ]+\nTo: [A-Za-z<>@\. ]+\n

Here is the setting in JEMHC:

When this email is run as a test case against our profile, we see the following result:

Create/Comment Post Field Processor Body Clean-up - Applies to both Create and Comment

This features allows you to remove specific lines of content after the Field Processor has processed the email. This allows you to remove content that may interfere with the detection of directives. This option can be configured to be used when Creating or Commenting on a issue.

In this example we are using the Create Post Field Processor Body Clean-up Regex to strip out the unwanted signature from an email. Here is what our incoming email looks like:

MIME-Version: 1.0 Received: by 10.223.112.12 with HTTP; Sat, 18 Jun 2011 22:42:26 -0700 (PDT) Date: Mon, 10 2015 2015 17:42:26 +1200 Subject: Remove unwanted content From: ryan@thepluginpeople.com To: changeme@thiswontwork.com Content-Type: text/plain; charset=UTF-8 Hello Support, Please help with my issue Kind Regards

To strip out the signature, we are using the following regex:

Here is the setting in JEMHC:

When this email is run as a test case against our profile, we see the following result:

Body Delimiter

Body Delimiters allow you to match on one specific point to remove the rest of the email content. This is useful when removing a signature or the previous email thread.

In this example we are using the Comment Body Delimiter to strip out the unwanted signature from an email. Here is what our incoming email looks like:

To strip out the signature, we are using the following regex:

The setting within JEMHC:

When this email is run as a test case against our profile, we see the following result:

Change when the Body Delimiter/Post Field Processor Body Clean-up is applied

The Body Delimiter can be configured to be applied either on Create or Comment. You must add the Body Delimiter to both Create and Comment if you require this to apply to both Create and Comment.

Specifying Create Only Body Delimiters/Clean-up

Press Create when you are in the Pre-Processing configuration. This will then change the Body Processor section to show the Delimiters that only apply during creation.

Specifying Comment Only Body Delimiters/Clean-up

Press Comment within the Pre-Processing configuration. This will then change the Body Processor section to show the Delimiters that only apply when commenting on a Issue.

Enabling and Disabling JEMHC Predefined Body Delimiters

Within the profile there are some predefined Body Delimiters which are created to match on common information that you may not want in the description/comment e.g. previous replies. These can be enabled or disabled by selecting the relevant Regex within Create/Comment Body Delimiter Regexes.

Enabling Predefined Body Delimiters

  1. Go to Body Processor section and press Edit

  2. Select either Create or Comment (Depending on when you want to the Delimiter to apply). Create in this example.

  3. Select the Predefined Body Delimiter (e.g. --?\n ) and press save.

  4. Once saved you will be able to see that the Body Delimiter has been Enabled within the Summary of the Pre-Processing section.

     

Disabling Predefined Body Delimiters

  1. Go to Body Processor section and press Edit

  2. Select either Create or Comment (Depending on when you do not want the Delimiter to apply). Create in this example.

  3. Hold down the CTRL key and Select (Left Mouse button) the Predefined Body Delimiter (e.g. --?\n ) and press save.

     

  4. Once saved, you will see that the Body Delimiter can only be seen within the Pre-Processing summary.