in reply to This regex: is there something bad there?..

There's nothing wrong with the regex. It will change $1 however. Is your code using $1 after the if and going into an infinite loop because the value isn't what you expect?