![]() ![]() ![]() |
In ColdFusion regular expressions, you can specify a character using one of the POSIX character classes. You enclose the character class name inside two square brackets, as in this example:
REReplace ("Allaire's Web Site","[[:space:]]","*","ALL")
This code replaces all the spaces with *, producing this string:
Allaire's*Web*Site
The following table shows the POSIX character classes that ColdFusion supports.
Supported Character Classes | |
---|---|
Character Class |
Matches |
alpha |
Matches any letter. Same as [A-Za-z]. |
upper |
Matches any upper-case letter. Same as [A-Z]. |
lower |
Matches any lower-case letter. Same as [a-z]. |
digit |
Matches any digit. Same as [0-9]. |
alnum |
Matches any alphanumeric character. Same as [A-Za-z0-9]. |
xdigit |
Matches any hexadecimal digit. Same as [0-9A-Fa-f]. |
space |
Matches a tab, new line, vertical tab, form feed, carriage return, or space. |
print |
Matches any printable character. |
punct |
Matches any punctuation character, that is, one of ! ` # S % & ` ( ) * + , - . / : ; < = > ? @ [ / ] ^ _ { | } ~ |
graph |
Matches any of the characters defined as a printable character except those defined to be part of the space character class. |
cntrl |
Matches any character not part of the character classes [:upper:], [:lower:], [:alpha:], [:digit:], [:punct:], [:graph:], [:print:], or [:xdigit:]. |
![]() ![]() ![]() |
AllaireDoc@allaire.com
Copyright © 1998, Allaire Corporation. All rights reserved.