Email — Pattern matching
In order to find particular information according to a pattern in an email, pattern matching is used. With pattern matching, the categoriser searches for information that follows a particular syntax. This syntax is based on pairs of keys and values and separators, which delimit them.
Assume that we want the categoriser to find the customer’s customer ID and that we want to use the customer’s social security number (SSN) as customer ID. The customer ID is specified in the automatically created email as follows: SSN: 771122-4499
The Key in pattern matching is the text entered in an email to point out where the information is. The key here is SSN.
Value is the information pointed out by a key. Produced values can preferably be saved as contact data. The value here is 771122-4499. The format of the value is described by a specification.
Specifications
Under the Email | Pattern matching menu option, the Specifications tab, you are able to define specifications which describe the appearance of values for different keys. The example below shows a specification which describes the value for PersonNummer, the Swedish type of social security number.
The value of the social security number 771122-4499 has the following format: 6-8 digits, an optional separator, and another 4 digits. We want to save the digits, but not the separator. All of this will be described using subspecifications. The social security number example consists of three subspecifications.
To add a subspecification in the Email – pattern matching window, start by doing any of the following under header Subspecification:
- Double-click on the first empty row
- Select Add in the context menu
- Press Insert on your keyboard
For each subspecification, you need to state the subspecification’s type, number of repetitions and whether or not it should be saved to a contact data key.
The following standard types of subspecifications are available:
Subspecification | Explanation |
---|---|
CapitalLetter | upper case letters, A to Z |
Character | any character, e.g. : or @ |
Digit | numbers, 0 to 9 |
Letter | all English letters |
LowercaseLetter | lower case letters, a to z |
You may also use a specific character by entering the desired character as subspecification.
Under Repetition, state the lowest and highest number of times this subspecification is to be repeated.
Tick the checkbox Is Saved if the value is to be saved in the contact data key.
When ACE Email Server is searching for values matching the description in the specification, the relative order between the subspecifications must be the same.
In the example we have also defined that the subspecification of the type "Separator" will occur once and that it should be excluded from a contact data key.
Note that the PersonNummer, social security number in the example, also could have been entered as 197711224499.
Patterns
The specification PersonNummer, describes the composition of the value for the pattern matching key PersonNummer. We are now going to add the key itself. To do this, switch to the Pattern tab.
In order for the pattern matching to work, Name must be identical to the string that is to be found in the email text. The Start and End separators specify the characters which delimit the key from its values. In our case, it ought to be ":" and ":" according to the example above.
The values allowed for a key are indicated by Specification. Here we choose our defined specification “PersonNummer”.
Under Contact data key, select the contact data key that is to hold the produced value. We choose "Identification".
Automatic answer depending on pattern matching
Let us briefly look at an example where pattern matching has been used to get values for different contact data keys, which in turn are used to decide which automatic answer to send.
According to the configuration above, emails
- with the subject booking in the header will be answered with the text defined under English,
- sent to the email address GolfdeskOnline.se will be answered with the text defined under order,
- where task type 230 has been given, will be answered with a default answer,
- where contact data keys do not match defined criteria, will be answered with a personal message with the default text.