but because they seem to be a difficult concept to grasp, many developers push them away into the corner,
forgetting that they even exist.
support regular expressions, and hopefully by the end of this primer you should be able to implement
some basic regular expression functionality into your PHP pages.
your PHP pages.
console-based text editors? Both support text input and let you save that text into a file, however
modern text editors also support other functionality including find-replace tools, which makes editing
a text file that much easier.
advanced find-replace tool that saves us the pain of having to write custom data validation routines
to check e-mail addresses, make sure phone numbers are in the correct format, etc.
several text validation functions that allow us to match a string using regular expressions, making
sure there’s a space here, a question mark there, etc.
you’ve mastered a few regular expressions (which are specially formatted strings that we can use
to tell the regular expression engine the portion of a string we want to match) you’ll be asking
yourself why you left regular expressions in the corner for so long.
Note: PHP has two sets of functions for dealing with the two types of
regular expression patterns: Perl 5 compatible patterns, and Posix standard compatible patterns. In
this article we will be looking at the
eregfunction and working with search expressions
that conform to the Posix standard. Although they don’t offer as much power as Perl 5 patterns, they’re
a great way to start learning regular expressions. If you’re interested in PHP’s support for Perl 5
compatible regular expressions, then see the PHP.net site for details on
pregset of PHP functions.