Table 3.4 lists interesting examples of regular expressions, many of which have been described in this chapter.
Item | Regular Expression |
---|---|
Postal Abbreviation for State | ![]() ![]() |
City, State | ^.*,![]() |
City, State, Zip (POSIX egrep) | ^.*,![]() ![]() |
Month, Day, Year | [A-Z][a-z]\{3,9\}![]() ![]() |
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 | \$[![]() |
troff In-line Font Requests | \\f[(BIRP]C*[BW]* |
troff Requests | ^\.[a-z]\{2\} |
troff Macros | ^\.[A-Z12]. |
troff Macro with arguments | ^\.[A-Z12].![]() |
HTML In-line Codes | <[^>]*> |
Ventura Publisher Style Codes | ^@.*![]() ![]() |
Match blank lines | ^$ |
Match entire line | ^.*$ |
Match one or more spaces | ![]() ![]() |
Copyright © 2003 O'Reilly & Associates. All rights reserved.