|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
GNU Anubis supports two types of regular expressions: POSIX (both basic and extended), and Perl-style regular expressions. The former are always supported, whereas the support for the latter depends on the configuration settings at compile time. By default POSIX extended regexps are assumed.
Regular expressions often contain characters, prefixed with a backslash (e.g. `\(' in basic POSIX or `\s' in perl-style regexp). Due to escape substitution (see backslash-interpretation), you will have to escape the backslash character, e.g. write:
modify :perl body ["\\stext"] "text"
# WRONG! modify :perl body ["\stext"] "text"
However, this rule does not apply to back references, i.e.
A number of modifiers is provided to change the type of regular expressions. These are described in the following table.
Indicates that the following pattern should be considered a regular expression. The default type for this expression is assumed.
The regular expression is a Perl-style one.
Disables regular expression matching, all patterns will be matched as exact strings.
Enables case-sensitive comparison.
Enables case-insensitive comparison.
Switches to the POSIX Basic regular expression matching.
Switches to the POSIX Extended regular expression matching.
The special statement
regex allows you to alter the default
regular expression type. For example, the following statement
regex :perl :scase
sets the default regular expression types to Perl-style, case-sensitive.
The settings of
regex statement regard only those patterns that
appear after it in the configuration file and have force until the
next occurrence of the
A couple of examples:
if header[Subject] :perlre "(?<=(?<!foo)bar)baz" ... fi
This will match any
Subject header whose value
matches an occurrence of `baz' that is preceded by `bar'
which in turn is not preceded by `foo'.
if header[Subject] :scase "^Re"
will match a
Subject header whose value starts with `Re',
but will not match it if it starts with `RE' or `re'.
When using POSIX regular expressions, the extended syntax is enabled
by default. If you wish to use a basic regular expression, precede
it with the
For the detailed description of POSIX regular expressions, See (regex)Top section `Regular Expression Library' in Regular Expression Library. For information about Perl-style regular expressions, refer to the Perl documentation.
|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]|
This document was generated on May, 24 2014 using texi2html 1.76.