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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.