Perl-Compatible Regular Expression Functions

Perl-compatible regular expression (PCRE) functions bring Perl’s parsing power to PHP. The syntax of the regular expression patterns is almost the same as Perl’s, except for a few custom PHP-specific modifications. Every pattern should be enclosed by the delimiters. Any character can be used as a delimiter as long as it’s not alphanumeric or a backslash. When the delimiter character has to be used in the pattern itself, it needs to be escaped by a backslash. As in Perl, the ending delimiter may be followed by optional modifiers that affect how the matching and pattern processing is done.

The complete syntax of PCRE patterns is described online at www.php.net/manual/en/pcre.pattern.syntax.php.

The ...

Get PHP Functions Essential Reference 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.