I think this has been reported before, but String.replace() is broken.
Example:
var z = " hello "; var zz = z.replace(/e/gi, "!"); // zz remains unchanged, should be " h!llo "
I guess it relates to the various Regex incompatibilities CK has mentioned…