a reg-exp assist - js

by "Michael Gerholdt" <gerholdt(at)fredonia.edu>

 Date:  Thu, 25 Apr 2002 11:55:07 -0400
 To:  <hwg-techniques(at)hwg.org>
  todo: View Thread, Original
re = /\$/g;
r2 = /,/g;


I can get these to work independently, but how can I combine them into one
pattern in JS?

I would think

re = /\$,/g;
a = $40,000;
a = a.replace(re,"");

so a = 40000 in the end.

but I get NAN when I try this.

In the meantime, I'm doing:

re = /\$/g;
r2 = /,/g;
a = a.replace(re,"");
a = a.replace(r2,"");

which yields the correct results .. but surely this is not necessary!

Thanks,
Mike

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA