#39: Regular Expressions

Sooner or later, you'll have to roll up your sleeves and learn about regular expressions, which are the most powerful tools available for matching text. Want to find all the words within angle brackets in order to strip HTML code out of a string? You'll need regular expressions. Want to find any IP addresses in a string? Want to make sure a user-chosen password isn't just a sequence of numbers (like 123456) or that it contains a mixture of uppercase and lowercase letters? Trying to sort through bad data in a database, and it turns out that your data entry people have listed a product's condition as nearmint, near/mint, near mint, and near-mint? You can use regular expressions to do all of these tasks.

However powerful regular ...

Get Wicked Cool PHP 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.