14.1. Perl Style

PHP provides two major interfaces for working with regular expressions. One of these interfaces supports Perl-style regular expressions. For many years Perl has been known as the big player in the regular expression business. Because many people like Perl's way of dealing with pattern matching, a set of functions has been implemented into PHP as well.

14.1.1. preg_match and Regular Expression Fundamentals

In this section, the preg_match function and regular expression fundamentals will be discussed, and you will take a closer look at the most important pattern modifiers.

14.1.1.1. Pattern Modifiers

The first important function is called preg_match and it can be used to see whether a certain pattern can be found in a string. Let's ...

Get PHP and PostgreSQL: Advanced Web Programming 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.