Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

regular expression replacing non number

Status
Not open for further replies.
Jun 19, 2001
86
US
I need help substituting non-numeric characters in a string.

I tried:

$text =~ s/\d/\1/g;

Doesn't seem to work.

Nathan
 
You can use either of
Code:
$text =~ s/\D//g;

# Or
$text =~ tr/0-9//cd;

jaa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top