Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Numbers only in a string

by saberworks (Curate)
on Sep 08, 2005 at 16:01 UTC ( [id://490251]=note: print w/replies, xml ) Need Help??


in reply to Numbers only in a string

s/[\D]+//g;

\D is the opposite of \d so it will replace anything that's not a digit.

Replies are listed 'Best First'.
Re^2: Numbers only in a string
by davidrw (Prior) on Sep 08, 2005 at 16:23 UTC
    don't need to use a character class here -- just:
    s/\D+//g;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://490251]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-23 23:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found