
Chapter 10
264
About regular expressions
Regular expressions are patterns that describe character combinations in text. Use
them in your searches to help describe concepts such as “sentences that begin with
‘The’” and “attribute values that contain a number.” The following table lists the
special characters in regular expressions, their meanings, and usage examples.
To search for text containing one of the special characters in the table, “escape” the
special character by preceding it with a backslash. For example, to search for the
actual asterisk in the phrase
some conditions apply*
, your search pattern
might look like this:
apply\*
. If you don’t escape the asterisk, you’ll find all the
occurrences of “apply” (as well as any of “appl”, “applyy”, and “applyyy”), not just
the ones followed by an asterisk.
Character
Matches
Example
^
Beginning of input or line.
^T
matches “T” in “This
good earth” but not in
“Uncle Tom’s Cabin”
$
End of input or line.
h$
matches “h” in “teach” but not in
“teacher”
*
The preceding character 0 or
more times.
um*
matches “um” in “rum”, “umm”
in “yummy”, and “u” in “huge”
+
The preceding character 1 or
more times.
um+
matches “um” in “rum” and
“umm” in “yummy” but nothing in
“huge”
?
The preceding character at most
once (that is, indicates that the
preceding character is optional).
st?on
matches “son” in
“Johnson” and “ston” in
“Johnston” but nothing in
“Appleton” or “tension”
.
Any single character except
newline.
.an
matches “ran” and “can” in the
phrase “bran muffins can be tasty”
x|y
Either x or y.
FF0000|0000FF
matches
“FF0000” in
bgcolor=”#FF0000”
and
“0000FF’” in
font
color=”#0000FF”
{n}
Exactly n occurrences of the
preceding character.
o{2}
matches “oo” in “loom” and
the first two o’s in “mooooo” but
nothing in “money”
{n,m}
At least n and at most
m occurrences of the
preceding character.
F{2,4}
matches “FF” in
“#FF0000” and the first four F’s in
#FFFFFF
Содержание 38028779 - Macromedia Dreamweaver - Mac
Страница 1: ...macromedia Using Dreamweaver...
Страница 148: ...Chapter 4 148...
Страница 296: ...Chapter 12 296...
Страница 472: ...Chapter 18 472...
Страница 512: ...Chapter 21 512...
Страница 562: ...Appendix 562...