RE: a reg-exp assist - js

by "Micah R. Condon" <micahc(at)webdezyne.com>

 Date:  Fri, 26 Apr 2002 09:16:34 -0600
 To:  "'Deborah Rorabaugh'" <librarian(at)shadolibrary.org>,
<hwg-techniques(at)hwg.org>
 In-Reply-To:  shadolibrary
  todo: View Thread, Original
re = /\$([0-9]+),?([0-9]+)/g;
a = $40,000;
a = a.replace(re,"$1$2");

-----Original Message-----
From: owner-hwg-techniques(at)hwg.org
[mailto:owner-hwg-techniques(at)hwg.org]On Behalf Of Deborah Rorabaugh
Sent: Friday, April 26, 2002 8:12 AM
To: hwg-techniques(at)hwg.org
Subject: RE: a reg-exp assist - js


I don't think you can combine them - when combined it will be looking for
the string '$,' to remove, not '$' then ','.

Deborah R.


-----Original Message-----
From: owner-hwg-techniques(at)hwg.org
[mailto:owner-hwg-techniques(at)hwg.org]On Behalf Of Michael Gerholdt
Sent: Thursday, April 25, 2002 8:55 AM
To: hwg-techniques(at)hwg.org
Subject: a reg-exp assist - js


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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.350 / Virus Database: 196 - Release Date: 4/17/02

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.350 / Virus Database: 196 - Release Date: 4/17/02

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

This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.