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.
NOTE: Regular expressions are globally consistent in being case insensitive
This holds 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 email, actually 'This'. In this case, the implied project key is ATST, so the regular expression needs to include the unique ( ) characters, but because we are using a regular expression, these character have special meaning and must be escaped with a single backslash, it becomes:
\(([A-Z]*)\)
Now, the only match that can be made with the entire regular expression in the subject is (ATST), but, the 1st capture group, that JEMH needs/uses, only covers A-Z*, resulting in a match for ATST. If this project key exists, it will be used.
Related articles