LanguagesPHP10 Number-based Examples for Deciphering PHP Regular Expressions

10 Number-based Examples for Deciphering PHP Regular Expressions

Developer.com content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

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

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories