Developing ColdFusion MX Applications with CFML
|
|
Using Regular Expressions in Functions
|
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, with the exception of case conversion sequences or escaped versions (e.g. \u or \\u).
- Embedded modifiers ( (?i), etc. ) always affect the entire expression, even if they are inside a group.
- \Q and the combinations \u\L and \l\U are not supported in replacement strings.
The following Perl statements are not supported:
- Lookbehind (?<=) (<?!)
- \x{hhhh}
- \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 http://www.oreilly.com.
Comments