Regular Expressions are required

Bill’s House O Insomnia : Regular Expression Recipes for Windows Developers: A Problem-Solution Approach (A Problem-Solution Approach): “”

(Via Bill Ryan.)

True story:
I know somebody who has, TWICE now, COMPLETELY REWRITTEN a javascript function because it had a regex in it and he didn’t understand what it was doing. I’ve pointed him to several resources, two books, and explained what the regex was doing myself. So we went from a single line regexp to multiple if-elses and swtich statements. Somebody run the old complexity-analyzer on that one.

There aren’t a lot of technologies that I push or say should be present in every devs toolbox, but regular expressions are one of them. You don’t have to memorize them, heck I have yet to write one without having a reference book open next to me, but you have to recognize them and know when they are appropriate.

  • Jeff Atwood

    > TWICE now, he has COMPLETELY REWRITTEN a javascript function because it had a regex in it and he didnt understand what it was doing

    So lame. Once, maybe, but twice is a pattern. This guy should not be a software developer.

  • Scott

    Yeah, I’m thinking about taking away his logical operators for a week or until he learns his lesson.

  • tod

    Yep, I’d have to say he wasn’t so much a ‘senior’ developer as much as he just worked at MS for enough years to get to the level (and payscale) that was only justifiable by adjusting his title to say ‘senior’ developer. Argh.

    I’m still new to developing (1 year) and have already started maintaining my own utilities class library with several regular expression checks in it. The second time I found myself writing a regular expression to verify a URL or date string submitted via a textbox it went in to my utilities class.

  • mike

    my current possition is the first ive had in a pure ms shop… and I can tell you this is part and parcel i think for how ms hides real code from developers… I had a parsing task, which I ended up completing w/ a combination of several regexes, upon discussion of the task, the “technical lead” didnt ever suggest regex, upon seeing the solution, he said “what is that” when I told him it was regex, he was like …. “you can use that in excel right”….

    ms teaches ms, a similar conversation w/ fellow developers I was trying to explain things like ajax… which was unkown to them, as well as concepts of open source…. again unkown to them…. scary