Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Strip out any non-numeric characters
Old 03-16-2005, 12:22 PM Strip out any non-numeric characters
fambi's Avatar
Ultra Talker

Posts: 339
Trades: 0
Hi everyone,

Can someone please let me know of a regexp that i can use to strip out any non-numeric characters from a telephone number?

I was using this:

$tel = preg_replace('[^0-9]', '', $tel);

But it suddenly stopped working and i can't figure out why!
__________________

Please login or register to view this content. Registration is FREE
from a
Please login or register to view this content. Registration is FREE
is easy!
Read this
Please login or register to view this content. Registration is FREE
that uses our
Please login or register to view this content. Registration is FREE
.

Last edited by fambi; 03-16-2005 at 12:46 PM..
fambi is offline
Reply With Quote
View Public Profile Visit fambi's homepage!
 
 
Register now for full access!
Old 03-16-2005, 12:55 PM
fambi's Avatar
Ultra Talker

Posts: 339
Trades: 0
It's sorted now! Don't know why it wasn't working though!
__________________

Please login or register to view this content. Registration is FREE
from a
Please login or register to view this content. Registration is FREE
is easy!
Read this
Please login or register to view this content. Registration is FREE
that uses our
Please login or register to view this content. Registration is FREE
.
fambi is offline
Reply With Quote
View Public Profile Visit fambi's homepage!
 
Old 03-16-2005, 01:38 PM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
Just for your reference...

http://regexlib.com/DisplayPatterns....6&categoryId=7

That page contains tons of regex patterns already made to handle phone numbers. They get a little more complex and can provide for much more accuracy in make sure phone numbers are valid.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 03-16-2005, 02:18 PM
fambi's Avatar
Ultra Talker

Posts: 339
Trades: 0
Thanks
__________________

Please login or register to view this content. Registration is FREE
from a
Please login or register to view this content. Registration is FREE
is easy!
Read this
Please login or register to view this content. Registration is FREE
that uses our
Please login or register to view this content. Registration is FREE
.
fambi is offline
Reply With Quote
View Public Profile Visit fambi's homepage!
 
Reply     « Reply to Strip out any non-numeric characters
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13411 seconds with 12 queries