Show TOC

Background documentationCreating Advanced Reply Expressions Locate this document in the navigation structure

 

Reply expressions of operator messages can be written as http://java.sun.com/javase/6/docs/api/java/util/regex/package-summary.html, 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 pre-defined 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 Note

Empty replies are not accepted!

End of the note.

Note 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+.

End of the note.

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

\

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

The following constructs are frequently used:

  • ^a|b|c$ - a combo-box which offers valid answers, "a", "b" or "c"

  • .* - Any reply accepted (except spaces, null replies).

  • .+ - Any reply accepted (except spaces; the regular expression disallows null replies).

  • \d+ - Any number of digits, used to require a job id.