Terrycloth (terrycloth) wrote,

  • Mood:

Adventures with Regexp

So... I'm trying to check in a massive code merge, and one of the reviewers comes back saying that I should do the normal 'replace throw() with NOTHROW' pass before checking in. This is really annoying to do by hand, so I get TextWrangler which does multi-file find and replace with regexps. I think 'okay, throw() is a pretty uncommon pattern' so I just tell it to find


and replace with


Only, I'm stupid. First, I forget to click 'case sensitive'. Second, I don't notice that () are special characters and don't get matched. So every instance of the word 'throw' in the project gets replaced by upper-case NOTHROW. Including, say, all the NOTHROWs we already had, which are now NONOTHROW.

Third, I spend the next hour or two searching through the code trying to clean up the HUMONGOUS mess I just created. x.x
  • Post a new comment


    default userpic

    Your reply will be screened

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.