> > RN> At 9:01 AM -0400 8/11/2001, Ranga Nathan wrote:
> > >> I have a string like "Balance is: 123,245.90"
> > >> when I match using /^Balance.*?([\d\,\.])/
> > >> I get a number that includes the commas.
> > >> Is there any way to get rid of the comms while matching?
>
hey-zeus, what am I thinking....
this is MUCH more simpler and even a bit more
intuitive, (though if your practicing
job security through code obscurity, you might
want to NOT do this one):
my $money = "Balance is 12,345,678,901,234,567.89";
my $value = join('',split(/[^0-9.], $money));;
print "value is $value \n";
This will split the string on anything that ISN'T
a number or decimal point, then join it back
together with a null string as glue.
again, no error checking, but hey, you get
what you pay for on this list...
;)
Greg