Online Appendix F:
Using Regular Expressions
You can use regular expressions when searching files or directories using Dreamweaver's Find and Replace features, described in Chapter 8, Working With Text; and with the Site Reports feature described in Chapter 21. Regular expressions are powerful text queries that use characters to define search patterns, so that you can constrain a search to find text strings that contain or do not contain a particular pattern or character.
Character -- What it Looks For -- Usage
^
Finds the character at the beginning of text input or line of HTML.
^H would find "Hello World," but not "Ernest Hemingway."
$
Finds the character at the end of text input or line of HTML.
d$ would find "Hello World," but not "Donald Duck."
*
Wildcard; finds the string with or without the preceding character.
il* would find "it" (no l), "ilk," (one 1), and "illinois" (two ls).
+
Finds the string with the preceding character included at least once.
il* would find "ilk," (one 1), and "illinois" (two ls), but not "it" (no l).
?
Finds the string with or without one instance of the preceding character.
l?sh would find "ticklish," "lush," or "toolshed," but not "lavish" or "wish."
. (period)
Finds any single character except newline (line feed).
.it would find "hit," "bitter," or "spit."
x¦y
Finds either x or y.
clod¦cloud would find either "clod" or "cloud."
{x}
Finds exactly x occurrences of the preceding character.
7{2} would find "77" and "10,770," but not "707."
{x,y} Finds at least n and no more than m occurrences of the preceding character.
0{1,3 }would find "10," "100," or "1,000," and it would also find "100000" based on the first three 000s.
[xyz]
Finds any of a range of characters as specified. Type the characters [12345] or a range using a hyphen [1-5].
[x-z] would find "lox," "yellow," and "bozo."
[^xyz]
Finds any character not specified. Type the characters [^12345] or a range using a hyphen [^1-5].
[^1-5] would find "72" but not "44."
\b
Finds the character preceded or followed by a word boundary (such as a space or carriage return).
\by would find "yellow' or "day," but not "mayo."
\B
Finds the character preceded or followed by a non-word boundary
\By would not find "yellow" or "day," but it would find "mayo" or "Layla."
\d
Finds any digit character. Equivalent to [0-9].
\d would find "OU812" or "Route66."
\D
Finds any non-digit character. Equivalent to [^0-9].
\D would find "976CLOD" or "401K."
\f
Form feed. (Nonprinting character; may show up in HTML as a block.)
Useful for files converted from word-processed or desktop-published documents.
\n
Line feed. (Nonprinting character; may show up in HTML as a block.)
Useful for files converted from word-processed or desktop-published documents.
\r
Carriage return. (Nonprinting character; may show up in HTML as a block.)
Useful for files converted from word-processed or desktop-published documents.
\s
Finds any single whitespace character, including space, tab, form feed, or line feed.
\stop
would find "tube top," but not "laptop."
\S
Finds any single non-whitespace character.
\Stop would find "laptop," but not "tube top."
\t
Finds tabs.
Useful for files converted from word-processed or desktop-published documents.
\w
Finds any alphanumeric character, including underscore.
1\w* (asterisk) would find "1B" or "1oz."
\W
Finds ny non-alphanumeric character, such as & or %.
\W would find the * in "Booz*Allen" or the @ in "shop@home."
\
Escape sequence for finding one of these expression characters.
To find ?. search for \?.
|