Adobe COLDFUSION 9 Manual page 758

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Requesting and Presenting Information
Special characters
Because special characters are the operators in regular expressions, to represent a special character as an ordinary one,
escape it by preceding it with a backslash. For example, use two backslash characters (\\) to represent a backslash
character.
Single-character regular expressions
The following rules govern regular expressions that match a single character:
• Special characters are:
+ * ? . [ ^ $ ( ) { | \
• Any character matches itself if it is not a special character or if a preceding backslash (\) escapes the character.
• A backslash (\) followed by any special character matches the literal character itself; that is, the backslash escapes
the special character.
• A period (.) matches any character except newline.
• A set of characters enclosed in brackets ([]) is a one-character regular expression that matches any of the characters
in that set. For example, "[akm]" matches an a, k, or m. If you include ] (closing square bracket) in square brackets,
it must be the first character. Otherwise, it does not work, even if you use \].
• A dash can indicate a range of characters. For example, [a-z] matches any lowercase letter.
• If the first character of a set of characters in brackets is the caret (^), the expression matches any character except
those characters in the set. It does not match the empty string. For example: "[^akm]" matches any character except
a, k, or m. The caret loses its special meaning if it is not the first character of the set.
• You can make regular expressions case insensitive by substituting individual characters with character sets; for
example, "[Nn][Ii][Cc][Kk]" is a case-insensitive pattern for the name Nick (or NICK, or nick, or even nIcK).
• You can use the following escape sequences to match specific characters or character classes:
Escape seq
Matches
[\b]
Backspace.
\b
A word boundary, such as a space.
\B
A nonword boundary.
\cX
The control character Ctrl-x. For example, \cv
matches Ctrl-v, the usual control character for
pasting text.
\d
A digit character [0-9].
\D
Any character except a digit.
\f
Form feed.
\n
Line feed.
\r
Carriage return.
Escape seq
Meaning
\s
Any of the following white-space characters: space,
tab, form feed, and line feed.
\S
Any character except the white-space characters
matched by \s.
\t
Tab.
\v
Vertical tab.
\w
An alphanumeric character or underscore. The
equivalent of [A-Za-z0-9_].
\W
Any character not matched by \w. The equivalent of
[^A-Za-z0-9_].
\n
Backreference to the nth expression in parentheses.
See "Backreferences" on page 754.
\ooctal
The character represented in the ASII character table
by the specified octal number.
\\xhex
The character represented in the ASCII character
table by the specified hexadecimal number.
Last updated 8/5/2010
753

Advertisement

Table of Contents
loading

Table of Contents