92
Chapter 7 Using Web Development Languages
Character classes
You can specify a character by using a POSIX character
class
. You enclose the
character class name inside two square brackets, as in this Replace example:
"Macromedia’s Web Site","[[:space:]]","*","ALL")
This code replaces all the spaces with *, producing this string:
Macromedia’s*Web*Site
The following table shows the supported POSIX character classes:
Multicharacter regular expressions
You can use the following rules to build multicharacter regular expressions:
•
Parentheses group parts of regular expressions together into grouped
subexpressions that can be treated as a single unit. For example, (ha)+ matches
one or more instances of “ha”.
•
A one-character regular expression or grouped subexpressions followed by an
asterisk (*) matches zero or more occurrences of the regular expression. For
example, [a-z]* matches zero or more lowercase characters.
•
A one-character regular expression or grouped subexpressions followed by a plus
(+) matches one or more occurrences of the regular expression. For example,
[a-z]+ matches one or more lowercase characters.
•
A one-character regular expression or grouped subexpressions followed by a
question mark (?) matches zero or one occurrences of the regular expression. For
example,
xy?z
matches either “xyz” or “xz”.
Character
Class
Matches
alpha
Any letter, [A-Za-z]
upper
Any uppercase letter, [A-Z]
lower
Any lowercase letter, [a-z]
digit
Any digit, [0-9]
alnum
Any alphanumeric character, [A-Za-z0-9]
xdigit
Any hexadecimal digit, [0-9A-Fa-f]
space
A tab, new line, vertical tab, form feed, carriage return, or space
Any printable character
punct
Any punctuation character:
! ‘ # S % & ‘ ( ) * + , - . / : ; < = > ? @ [ / ] ^ _ { | } ~
graph
Any character defined as a printable character except those defined as
part of the space character
class
cntrl
Any character not part of the character classes:
[:upper:], [:lower:], [:alpha:], [:digit:], [:punct:], [:graph:], [:print:], [:xdigit:]
Содержание ColdFusion Server 5
Страница 18: ...xviii About This Book...
Страница 26: ...8 Chapter 1 Setting Up the Product...
Страница 42: ...24 Chapter 2 Configuring Browsers and Servers...
Страница 60: ...42 Chapter 3 Exploring the Workspace...
Страница 100: ...82 Chapter 6 Editing Pages...
Страница 126: ...108 Chapter 7 Using Web Development Languages...
Страница 212: ...194 Chapter 13 Customizing the Development Environment...
Страница 320: ...302 Glossary...