O'Reilly logo

PHP 5 Power Programming by Derick Rethans, Stig Sæther Bakken, Andi Gutmans

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

9.3. Regular Expressions

Although regular expressions are very powerful, they are difficult to use, especially if you're new to them. So, instead of jumping on the functions that PHP supports for dealing with the regular expressions, we cover the pattern matching syntax first. If PCRE is enabled, the following should show up in phpinfo() output, as shown in Figure 9.3.

Figure 9.3. PCRE phpinfo() output.

9.3.1. Syntax

PCRE functions check whether a text string matches a pattern. The syntax of a pattern always has the following format:

<delimiter> <pattern> <delimiter> [<modifiers>]

The modifiers are optional. The delimiter ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required