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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.