virtuexru Posted March 13, 2007 Share Posted March 13, 2007 I want to make sure my users are entering their phone in a certain format, namely... 000-000-0000 where 0 = any #. how would i setup a preg_match function to check that? Quote Link to comment Share on other sites More sharing options...
bwochinski Posted March 13, 2007 Share Posted March 13, 2007 <?php $number = '555-123-9876'; if ( preg_match('/^\d{3}-\d{3}-\d{4}$/',$number) ) { valid! } else { Invalid! } ?> Quote Link to comment Share on other sites More sharing options...
effigy Posted March 13, 2007 Share Posted March 13, 2007 See this in regards to the use of $. Quote Link to comment Share on other sites More sharing options...
virtuexru Posted March 13, 2007 Author Share Posted March 13, 2007 Perfecto Bwochinski, thank you. Quote Link to comment 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.