sed & awksed & awkSearch this book

3.3. I Never Metacharacter I Didn't Like

Table 3.4 lists interesting examples of regular expressions, many of which have been described in this chapter.

Table 3.4. Useful Regular Expressions

Item Regular Expression
Postal Abbreviation for State Figure [A-Z][A-Z]Figure
City, State ^.*,Figure [A-Z][A-Z]
City, State, Zip (POSIX egrep) ^.*,Figure [A-Z][A-Z]Figure [0-9]{5}(-[0-9]{4})?
Month, Day, Year [A-Z][a-z]\{3,9\}Figure [0-9]\{1,2\},Figure [0-9]\{4\}
U.S. Social Security Number [0-9]\{3\}-[0-9]\{2\}-[0-9]\{4\}
North-American Local Telephone [0-9]\{3\}-[0-9]\{4\}
Formatted Dollar Amounts \$[Figure 0-9]*\.[0-9][0-9]
troff In-line Font Requests \\f[(BIRP]C*[BW]*
troff Requests ^\.[a-z]\{2\}
troff Macros ^\.[A-Z12].
troff Macro with arguments ^\.[A-Z12].Figure ".*"
HTML In-line Codes <[^>]*>
Ventura Publisher Style Codes ^@.*Figure =Figure .*
Match blank lines ^$
Match entire line ^.*$
Match one or more spaces Figure Figure *



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.