Exim supports the use of regular expressions in many of its options. It uses the PCRE regular expression library; this provides regular expression matching that is compatible with Perl 5. The syntax and semantics of regular expressions is discussed in many Perl reference books, and also in Jeffrey Friedl's Mastering Regular Expressions (O'Reilly, ISBN 0-596-00289-0).
The documentation for the syntax and semantics of the regular expressions that are supported by PCRE is included in plain text in the file doc/pcrepattern.txt in the Exim distribution, and also in the HTML tarbundle of Exim documentation, and as an appendix to the Exim book. It describes in detail the features of the regular expressions that PCRE supports, so no further description is included here. The PCRE functions are called from Exim using the default option settings (that is, with no PCRE options set), except that the PCRE_CASELESS option is set when the matching is required to be case-insensitive.
A program called pcretest forms part of the PCRE distribution and is built with PCRE during the process of building Exim. It is primarily intended for testing PCRE itself, but it can also be used for experimenting with regular expressions. After building Exim, the binary can be found in the build directory (it is not installed anywhere automatically). There is documentation of various options in doc/pcretest.txt, but for simple testing, none are needed. This is the output of a sample run of pcretest:
After the ``re>'' prompt, a regular expression enclosed in delimiters is expected. If this compiles without error, ``data>'' prompts are given for strings against which the expression is matched. An empty data line causes a new regular expression to be read. If the match is successful, the captured substring values (that is, what would be in the variables $0, $1, $2, etc.) are shown. The above example tests for an email address whose domain ends with either ``ac'' or ``edu'' followed by a two-character top-level domain that is not ``kr''. The local part is captured in $1 and the ``ac'' or ``edu'' in $2.