Appendix A. Regular Expressions

Regular expressions enable one to search for common patterns in text files. Many tools support regular-expression-based search and replace. Although there are small differences in syntax from one tool to the next, most of the syntax and the basic ideas are much the same.

Characters That Match Themselves

The first rule of regular expressions is that most normal characters match themselves. A “normal” character is a letter, a digit, or a space. Thus, the regular expression “Al Gore was elected president in the year 2000” matches exactly the string “Al Gore was elected president in the year 2000” and no others. Searching for that string will find all occurrences of that exact string in the searched document or documents. ...

Get Refactoring HTML: Improving the Design of Existing Web Applications now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.