Adding the m option to the regex might help this - m{}xgsm, but I'm having the same problem... Any solution I've come up with so far won't match multi line comments. However, if the original doesn't either, and this isn't a requirement, then perhaps that's not a problem.