Use Project Auto Assign from Subject

Scenario

You would like to match a specific part of the subject as a project key.  If found, issues will be created in the related project.

Configuration

This is not specific to directives, you don't need the Subject Field Processor for this to work, it's a single regular expression:

Example Test Case Message

This message can be cut/pasted into a JEMH Test Case.

MIME-Version: 1.0
Received: by 10.223.112.12 with HTTP; Tue, 4 Dec 2012 22:42:26 -0700 (PDT)
Date: Tue, 4 Dec 2012 17:42:26 +1200
Message-ID: <BANLkTinB1mfSh+GwOXGNWoL4SyDvOpdBoQ@mail.gmail.com>
Subject: This is a starting email template, update as required (ATST)
From: "A User" <user@faraway.com>
To: notest@localhost
Content-Type: text/plain; charset=UTF-8

some text

Project Auto Assign from Subject

This field, if present will be used to locate a match in the subject through the related 1st capture group.

Regular Expressions are globally consistent in being case insensitive.  This holds true for email address, project key as well as subject matching.  This behaviour is aimed at making regexps easier to use in JEMH, though does reduce accuracy in some cases.

For example, the regular expression ([A-Z]*) will match the first alphabetical word in the subject, 'This'.  In this case the implied project key is ATST, so the regular expression needs to include the parentheses ( ) characters.  However,  when using regular expressions, these characters have special meaning (capturing groups) and must be escaped with a single backslash.  Therefore the regular expression becomes: \(([A-Z]*)\)

Now, the only match that can be made with the entire regular expression in the subject is (ATST), but due to the inner parentheses being a capture group, the resulting match is ATST.  If this project key exists, it will be used.

Related articles