strtok function: regular expressions PHP

Fortunately, PHP offers something more powerful than the strtok function: regular expressions. Written in a language of their own, regular expressions describe patterns that are compared to strings. The PHP source code includes an implementation of regular expressions that conform to the POSIX 1003.2 standard.

In 1999, Andrei Zmievski added support for regular expressions that follow the style of Perl. They offer two advantages over PHP native regular expressions. They make it easier to copy an expression from a Perl script, and they take less time to execute.

It is beyond the scope of this text to examine regular expressions in depth. It is a subject worthy of a book itself. I will explain the basics, as well as demonstrate the various PHP functions that use regular expressions. An excellent resource for learning more about regular expressions is chapter 2 of Ellie Quigley's UNIX Shells by Example.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

PHP Topics