Click to See Complete Forum and Search --> : RegExp??? - newbie


Gremdel
12-01-2002, 04:28 PM
Here's a real easy question. I hope. Can someone tell me why this doesn't work:

var stringTest = "Grendel";
pattern = new RegExp("n");
stringTest.replace(pattern,'m');
alert(stringTest);

All it "returns" is "Grendel". It doesn't report an error or anything, it just fails to match the 'n'.

Gremdel
12-02-2002, 11:43 PM
Thanks Dave, works like a charm. I assume it's the same for match(...) as well.

What I really wanted it for was to strip commas and '$' out of money strings. That's easy enough but does anyone have a quick and easy way to put them back in? Don't rack your brains too hard, I already wrote a long and hard way to put them back. I was just wondering if there was a way to use regular expressions.

Thanks again.

jboyce
04-19-2006, 10:27 AM
select '$'||ltrim(to_char(4532.59,'999,999,999,999.99')) as amount from dual