Writing some Regular Expressions?
Some people, when confronted with a problem, think “I know, I’ll use regular expressions.” Now they have two problems.
Well, not really. There are some cases where using a Regular Expression—RegEx— instead of a heap of convoluted
if statements just makes sense from both a lazy and practical standpoint.
When you’re knee-deep in writing your RegEx, you’ll need to test. My favorite RegEx ‘workbench’ is Oliver Steele’s “reWork.”
To get a jumpstart on writing complex RegEx, check out the Regular Expression Library, which contains a plethora of user-submitted RegEx recipes. Some of them are quite good (check each recipe’s rating).
- New tutorial: Regular expressions (nofluffjuststuff.com)
- An SEO’s Guide to RegEx (seomoz.org)
- Regular Expressions Cookbook (O’Reilly) (i-programmer.info)
September 27, 2012 Thursday at 10:14 pm