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).