| Contents > Developing ColdFusion MX Applications > Using Regular Expressions in Functions > Regular expression syntax > Using escape sequences |
|
|
|
|
||
Escape sequences are special characters in regular expressions preceded by a backslash (\). You typically use escape sequences to represent special characters within a regular expression. For example, the escape sequence \t represents a tab character within the regular expression, and the \d escape sequence specifies any digit, similar to [0-9]. In ColdFusion the escape sequences are case-sensitive.
The following table lists the escape sequences supported in ColdFusion:
Escape Sequence |
Description |
|---|---|
\b |
Specifies a boundary defined by a transition from an alphanumeric character to a nonalphanumeric character, or from a nonalphanumeric character to an alphanumeric character. For example, the string " Big" contains boundary defined by the space (nonalphanumeric character) and the "B" (alphanumeric character). The following example uses the \b escape sequence in a regular expression to locate the string "Big" at the end of the search string and not the fragment "big" inside the word "ambiguous". reFindNoCase("\bBig\b", "Don't be ambiguous about Big.") <!--- The value of IndexOfOccurrence is 26 ---> When used inside of a character set (e.g. [\b]), it specifies a backspace |
\B |
Specifies a boundary defined by no transition of character type. For example, two alphanumeric character in a row or two nonalphanumeric character in a row; opposite of \b. |
\A |
Specifies a beginning of string anchor, much like the ^ special character. However, unlike ^, you cannot combine \A with (?m) to specify the start of newlines in the search string. |
\Z |
Specifies an end of string anchor, much like the $ special character. However, unlike $, you cannot combine \Z with (?m) to specify the end of newlines in the search string. |
\n |
Newline character |
\r |
Carriage return |
\t |
Tab |
\f |
Form feed |
\d |
Any digit, similar to [0-9] |
\D |
Any nondigit character, similar to [^0-9] |
\w |
Any alphanumeric character, similar to [[:alnum:]] |
\W |
Any nonalphanumeric character, similar to [^[:alnum:]] |
\s |
Any whitespace character including tab, space, newline, carriage return, and form feed. Similar to [ \t\n\r\f]. |
\S |
Any nonwhitespace character, similar to [^ \t\n\r\f] |
\xdd |
A hexadecimal representation of character, where d is a hexadecimal digit |
\ddd |
An octal representation of a character, where d is an octal digit, in the form \000 to \377 |
|
|
||
| Contents > Developing ColdFusion MX Applications > Using Regular Expressions in Functions > Regular expression syntax > Using escape sequences |
|
|
ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting
Version 6.1
Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/regexp12.htm
Comments
isaac dealey said on Nov 9, 2003 at 2:56 PM : Steve said on Aug 6, 2004 at 9:19 AM : Adam Cameron said on Dec 27, 2004 at 7:11 PM :