Perl Compatible Regular Expressions

Perl is a powerful scripting language. It was originally designed as a replacement for more limited Unix shell tools, and one of its core features is an extended regular expression engine. PHP provides support for the Perl regular expression syntax, giving you a suite of flexible tools for managing and transforming text.

A regular expression is a combination of symbols that match a pattern in text. Learning how to use regular expressions, therefore, is much more than learning the arguments and return types of PHP’s regular expression functions. We will begin with the functions and use them to introduce regular expression syntax.

Matching Patterns with preg_match()

preg_match() accepts four arguments: a regular ...

Get Sams Teach Yourself PHP in 24 Hours, 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.