develooper Front page | perl.beginners | Postings from January 2002

Fw: substitute all non-digits with ''. I think I saw this posted rec ently, but I could not find it...

From:
Tanton Gibbs
Date:
January 7, 2002 12:26
Subject:
Fw: substitute all non-digits with ''. I think I saw this posted rec ently, but I could not find it...
Message ID:
00b601c197b8$7141d140$7c486e0a@brooklyn

----- Original Message -----
From: "Tanton Gibbs" <thgibbs@deltafarms.com>
To: "Tanton Gibbs" <thgibbs@deltafarms.com>
Sent: Monday, January 07, 2002 3:06 PM
Subject: Re: substitute all non-digits with ''. I think I saw this posted
rec ently, but I could not find it...


> oops :)  forgot the c on my tr
>
> $str =~ tr/0-9//cd;
> ----- Original Message -----
> From: "Tanton Gibbs" <thgibbs@deltafarms.com>
> To: "McCollum, Frank" <frank.mccollum@bankofamerica.com>;
> <beginners@perl.org>
> Sent: Monday, January 07, 2002 2:53 PM
> Subject: Re: substitute all non-digits with ''. I think I saw this posted
> rec ently, but I could not find it...
>
>
> > \D means anything that is not a digit, so
> >
> > $str = "AB123CD";
> > $str =~ s/\D//g;
> >
> > will work.
> >
> > Also, you could use tr
> >
> > $str =~ tr/0-9//d;
> > ----- Original Message -----
> > From: "McCollum, Frank" <frank.mccollum@bankofamerica.com>
> > To: <beginners@perl.org>
> > Sent: Monday, January 07, 2002 2:52 PM
> > Subject: substitute all non-digits with ''. I think I saw this posted
rec
> > ently, but I could not find it...
> >
> >
> > > I want to take all non-digits and drop them out of my string.  I would
> > think
> > > it would be something like...
> > >
> > > s/!(\d+)//;  but this is not the case
> > >
> > >
> > >
> > > Frank McCollum
> > > Bank Of America Securities, LLC
> > > frank.mccollum@bankofamerica.com
> > > (704) 388-8894
> > >
> > > --
> > > To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> > > For additional commands, e-mail: beginners-help@perl.org
> > >
> >
> >
> > --
> > To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> > For additional commands, e-mail: beginners-help@perl.org
> >
>




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About