I got bit by that bug today. Working in VB 6 I was using some regexes to parse some filepaths pulling back certain sub-folders. They worked mostly but they weren't catching the folder that had non-alphanumeric characters. Which isn't surprising since I was only testing for alphanumerics. So i went over to the regexlib and found just what I needed and paste it in the appropriate place. But as I was stepping through my code suddenly the Regexp object wasn't working. I was first looking to see if there was a match and if there was executing the regex pull what I needing out of the match collection. As I stepped thru the if test would branch as though it was returning true, bu the execute wouldn't return any matches. I copied the expression and pasted into the regulator. Tested it with the input that wasn't working and it worked like It should have. But when I again test my code the regexp still weren't working right. And the error message were generic and unhelpful. I was completely baffled I was going nuts trying to figure out what was wrong. I rebooted, reinstalled the scripting engine, didn't help. Then it dawned on me. The snippet I copied from the regexlib was using a look-behind and the VBScript regex syntax doesn't support look-behinds. So basically there was a syntax error (for VBScript) in the pattern. So none of the Regexp's methods were working with the invalid pattern throwing up none descriptive error message.I changed the regex back to it's original form and everything started working again.
Today's lesson? test your regexes with the same engine you are going to use it with.