Regular Expressions: A Primer

Well, this morning I finally came across a problem where I couldn't avoid regular expressions anymore. Sure, I've used them in form validation, but I've pretty much always just copied existing code for validating email addresses etc, without much attention to the gibberish of characters that magically format or validate my string.

I busted out google and did a bit of searching; this is the page I found to be the most informative in the briefest amount of wordage:

This page has a nice example chart at the bottom which for me really helped with my understanding of how it all works. I recommend anyone who hasn't bitten the bullet in this department to do a quick read over of this page, as regular expressions are pretty much a staple of any sort of semi-advanced programming.

And yes, you can now mock me for not bothering to learn this prior to now. Yay for self taught programmers!


Post a Comment