Jump to content

PHP Regex Question


Drack
 Share

Recommended Posts

I'm in need of a way to eliminate all non-numeric characters from a string.

Something in PHP that would accomplish this in perl:


$code =~ s/[^0123456789]//;

This is for the ClanOCR database, by the way.

Anyone have any ideas? I don't know how to call a substitution regex in PHP, just match patterns. Perhaps there's some way to loop over the characters in a string and remove any that don't match 0123456789?

--Drack

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...