PHP regular expression syntax is almost as indecipherable as the United States tax code, prompting the programmer to consult a manual almost automatically every time he or she needs to perform a particularly complex parsing task. If you're one of those programmers who would like to decipher the mish-mash of backslashes, brackets, asterisks and other characters that somehow can root out everything from email addresses to HTML tags, Jason Gilmore has written a PHPBuilder.com tutorial just for you. He introduces PHP regular expressions using 10 numerically-oriented examples.
- Finding digits
- Finding groups of digits
- Filtering unwanted strings
- Expanding your range
- Increasing your selectivity
- Finding more complex patterns
- Accounting for inconsistency
- Correcting errors
- Taking advantage of alternative syntax
- Avoiding regular expressions
With these examples and some practice, constructing even complex regular expressions will become as natural as riding a bicycle.