RE: a reg-exp assist - js
by "Jason K. Chapman" <theguild(at)interserv.com>
|
Date: |
Sat, 27 Apr 2002 07:53:33 -0400 |
To: |
<hwg-techniques(at)hwg.org> |
References: |
shadolibrary |
|
todo: View
Thread,
Original
|
|
At 09:16 AM 4/26/2002 -0600, Micah R. Condon wrote:
>re = /\$([0-9]+),?([0-9]+)/g;
>a = $40,000;
>a = a.replace(re,"$1$2");
I don't know what the possible number range is, but the above won't work
for $1,000,000. The best bet would be:
re = /[\$,]/g;
a = $40,000,000,000;
a = a.replace(re,"");
This will eliminate any number of commas, with or without a dollar sign.
Jason K. Chapman
--
THE HERETIC, a cyber thriller by Jason K. Chapman.
Online edition at <http://www.happyhacker.org/heretic/>. Softcover,
ISBN 1-929925-38-7. Latest news at <http://www.jasonkchapman.com>
HWG hwg-techniques mailing list archives,
maintained by Webmasters @ IWA