cooldude832 Posted October 12, 2007 Share Posted October 12, 2007 I want to remove all the . / ( ) from a phone number, I figured a preg_replace be best but I have no clue what pattern to use <?php $pattern = ""; $data['Phone'] = preg_replace($pattern, "" ,$contacts['Work_Phone']); Quote Link to comment https://forums.phpfreaks.com/topic/73003-solved-removing-the-characters-from-phone-numbers/ Share on other sites More sharing options...
wildteen88 Posted October 12, 2007 Share Posted October 12, 2007 Just use /[^0-9]/ as the pattern. That expression means match (replace) all non numeric characters. Quote Link to comment https://forums.phpfreaks.com/topic/73003-solved-removing-the-characters-from-phone-numbers/#findComment-368118 Share on other sites More sharing options...
cooldude832 Posted October 12, 2007 Author Share Posted October 12, 2007 nice idea. Keep what I want instead of find what I don't want. Quote Link to comment https://forums.phpfreaks.com/topic/73003-solved-removing-the-characters-from-phone-numbers/#findComment-368120 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.