[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

10.2.8.6 Regular Expressions

Rewrite uses POSIX regular expressions (See (regex)Top section `Regular Expression Library' in Regular Expression Library, for the detailed description of these).

You control the exact type of regular expressions by the use of the pragmatic comment regex. Its syntax is as follows:

 
#pragma regex option-list

Option-list is a whitespace-separated list of options. Each option is one of the following words prefixed with ‘+’ or ‘-’:

extended

Use POSIX extended regular expression syntax when interpreting regular expressions.

icase

Do not differentiate case. Subsequent regular expression comparisons will be case insensitive.

newline

Match-any-character operators don't match a newline.

A non-matching list (‘[^...]’) not containing a newline does not match a newline.

Match-beginning-of-line operator (‘^’) matches the empty string immediately after a newline.

Match-end-of-line operator (‘$’) matches the empty string immediately before a newline.

Prefixing an option with ‘+’ means to enable the corresponding behavior. Prefixing it with ‘-’ means to disable it. Thus, the following statement:

 
#pragma regex +extended +icase

will enable extended POSIX regular expressions using case-insensitive comparison.

Using the following comment:

 
#pragma regex -extended 

will switch to the basic POSIX regular expressions.

The settings of a regex pragmatic comment remain in force up to the end of current source file, or to the next regex comment, whichever occurs first.

For compatibility with previous versions, GNU Radius uses the following defaults:

 
#pragma regex -extended -icase -newline

i.e. all regular expressions are treated as basic POSIX, comparison is case-sensitive.


This document was generated by Sergey Poznyakoff on December, 6 2008 using texi2html 1.78.