Developer Reading List, April 02, 2013 New books on Java, Erlang, Unit Testing, Windows and more.
by Jan Goyaverts and Steven Levithan
Regular expressions are probably the one aspect of programming that drives nearly every developer crazy at one point or another. Even if you love regular expressions, there is little defense to early Netscape engineer Jamie Zawinski's famous witticism: "Some people, when confronted with a problem, think 'I know, I'll use regular expressions.' Now they have two problems." There are essentially two solutions to the problem of using regular expressions (regex). The first is to study and practice them until you've mastered the patterns and can string them together effectively. This approach has several limitations: regex syntax is not portable across languages and, unless you use a lot of regular expressions, you're liable to slowly forget the all but the most primitive expressions. The second option is to do a quick Web search when a regex is needed. This is precisely what the Web is useful for leveraging the experience of others who've had a similar need. The drawback is that you must find a regex formulation in your language that you know to be correct. There are lots of problems here: If it's not correct or if it's not exactly what you want, then you'll need to fix it, which brings you back to your original problem.