12.8. Regular Expressions

Regular expressions offer a powerful way to test strings for the presence of patterns. They use a language all their own to describe patterns, a language that consists mostly of symbols. PHP offers two types of functions for regular expressions: native and Perl-compatible. You may wish to turn to Chapter 22, which describes regular expressions in detail.

Andrei Zmievski added support to PHP for Perl-compatible regular expressions. Expressions are surrounded by delimiters, which are usually / or | characters, but can be any printable character other than a number, letter, or backslash. After the second delimiter, you may place one or more modifiers. These are letters that change the way the regular expression is interpreted. ...

Get Core PHP Programming, Third Edition 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.