http://www.developer.com/

Back to article

10 Number-based Examples for Deciphering PHP Regular Expressions


July 20, 2010

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.

  1. Finding digits
  2. Finding groups of digits
  3. Filtering unwanted strings
  4. Expanding your range
  5. Increasing your selectivity
  6. Finding more complex patterns
  7. Accounting for inconsistency
  8. Correcting errors
  9. Taking advantage of alternative syntax
  10. Avoiding regular expressions

With these examples and some practice, constructing even complex regular expressions will become as natural as riding a bicycle.


Read the full story at PHPBuilder:
10 Easy Examples for Deciphering PHP Regular Expressions

Sitemap | Contact Us

Thanks for your registration, follow us on our social networks to keep up-to-date