Types of regular expression technologies

Many types of regular expression technologies are available to programmers. JavaScript, Perl, and POSIX are all examples of different regular expression technologies. Each technology has its own syntax specifications and is not necessarily compatible with other technologies.

ColdFusion supports regular expressions that are Perl compliant with a few exceptions:

  • A period, ., always matches newlines.

  • In replacement strings, use \n instead of $n for backreference variables. ColdFusion escapes all $ in the replacement string.

  • You do not have to escape backslashes in replacement strings. ColdFusion escapes them, except in case conversion sequences or escaped versions (for example, \u or \\u).

  • Embedded modifiers such as (?i) always operate on the entire expression, even if they are inside a group.

  • \` and the combinations \u\L and \l\U are not supported in replacement strings.

The following Perl statements are not supported:

  • Lookbehind (?<=) (<?!)

  • \\x

  • \N

  • \p

  • \C

An excellent reference on regular expressions is Mastering Regular Expressions, by Jeffrey E. F. Friedl, O'Reilly & Associates, Inc., 1997, ISBN: 1-56592-257-3, available at www.oreilly.com.