Chapter 13. Regular Expressions

If there were just two things you should understand about regular expressions, they would be that regular expressions are supremely useful in advanced programming and that they’re easy to use but taxing to write.However, once you understand the rules for writing regular expressions, that extra knowledge will pay off in spades because regular expressions can vastly improve the quality of your programming.

This chapter will identify what regular expressions are, discuss the rules for constructing them (in great detail), and provide some useful examples demonstrating their capabilities.

What Are Regular Expressions?

Think of regular expressions as an elaborate system of matching patterns.

For example, a United State zip ...

Get PHP for the World Wide Web, Second Edition: Visual Quickstart Guide 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.