HTML and CSS Reference
In-Depth Information
Metacharacters
Other ASCII characters are reserved and must be escaped if you wish to match them. For noncontrol characters,
you do this with a backslash. For example, to match a period, you use \. . (This is also called a character
representation .) To match a question mark, you use \? . To match a left parenthesis, you use \( . To match a
right parenthesis, you use \) . To match a backslash, you type \\ , and so forth. Table A.2 shows some more
examples.
Table A.2. Metacharacters
Pattern
Matches
Example
<!\[CDATA\[
The string <![CDATA[
<![CDATA[
<\?xml-stylesheet
The string <?xml-stylesheet
<\?xml-stylesheet
\(\)
The string ()
()
2\*\*3
The string 2**3
2**3
2 \+ 2 = 4
The string 2 + 2 = 4
2 + 2 = 4
\$19\.95
The string $19.95
$19.95
There are also character representations for many control characters, such as these seven:
\r for carriage return
\n for line feed
\t for tab
\f for form feed
\a for alarm
\b for backspace
\e for escape
However, we don't use these a lot when refactoring HTML because these characters aren't very important in
HTML. Usually what you care about is whether there's some whitespace, not exactly which character it is. The
last four characters are not even legal in XML documents, including XHTML documents. The form feed, \f , is the
only one of these that's even remotely common. It would not be a bad idea to do a quick search for \f . If you
find any, inspect the document where it appears to find out what purpose it serves. You can likely replace it with
a br element, a p element, or a single space.
 
Search WWH ::




Custom Search