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']); 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. 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. 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
Archived
This topic is now archived and is closed to further replies.