Is there any reason why RegExp wouldn't be able to find a period?
str = '256.89';
a = new RegExp('(\.)');
b = /(\.)/;
alert(str.replace(a, 'x$1x'));
alert(str.replace(b, 'x$1x'));
The alert for a says
x2x56.89
However the alert for b says
256x.x89
b is the result I want, because it means that the period was found. a
is just finding a single character, as if it's ignoring the escape in
front of the period.
I've tried this in IE and Mozilla.