Creating Advanced Operator Message Reply Expressions
Reply expressions of operator messages of System_OperatorMessage processes can be written as regular expressions, which have a syntax similar to that used by Perl. Regular expressions are used to match a character sequence in a string, here they are used to force valid answers and can be used to create lists of predefined answers.
With the use of regular expression, you can force operators to provide a reply that matches a specific pattern, the table below lists some of the characters that have a special meaning in regular expressions.
note
Empty replies are not accepted!
note
Spaces before and after the reply are trimmed. Multiple spaces and/or tabs in a sequence in the reply are replaced with one space. This means that replies consisting of spaces and/or tabs only are not allowed. It is not possible to answer a reply expression like \s
or \s+
.
Special character | meaning |
---|---|
. | Any one character (equivalent to '?' on Microsoft Windows systems) |
* | Used in conjunction with another character, the previous character sequence repeated zero or more times. |
+ | Used in conjunction with another character, the previous character sequence repeated one or more times. |
? | Used in conjunction with another character, the previous character sequence repeated once or not at all. |
^ | Starts with |
| | The "or" character |
$ | Ends with |
</code> | The escape character, used as prefix to specify any special character |
The following table lists some special patters patterns:
Patterns | Description |
---|---|
\n | A newline character |
\d | A digit |
\D | Anything but a digit |
\w | Any character except space, tab, |
The following constructs are frequently used:
^a|b|c$
- a combo-box which offers valid answers, "a", "b" or "c"*
. - Any reply accepted (except space(s), null replies)..+
- Any reply accepted (except space(s)).\d+
- Any number of digits, used to require an ID, for example.