4.4 Regular Expressions

The patterns used in the PyLly lexer spec file use standard regular expression conventions. All patterns must be enclosed in quotes. Quotes may appear within patterns as long as they are escaped to avoid ending the pattern. The following regular expression operators are provided:

Expression  Description 
( re ) Parentheses can be used to override precedence rules.
re re A regular expression can be concatenated with another.
re | re Match either re.
re + Specify that re be matched one or more times.
re * Specify that re be matched zero or more times.
re ? Specify that re be matched zero or one times.
. Matches any character other than newline.

Regular expression primitives are either characters, escaped characters or character classes. Most characters can be given directly. Special characters such as quote, question mark and vertical bar must be escaped with a backslash (eg. \? for question mark) to prevent them from being interpretted as regular expression operators. The newline, tab, carriage return and NUL characters are specified with \n, \t, \r and \0 respectively.

See the PyGgy Home Page.