l0ve2hat3 Posted September 11, 2008 Share Posted September 11, 2008 i just want to know the string to use to determin numbers and - only... no specific order... 123-123-1234 is valid 12-1234-4561 is valid 111111111 is vaild (454) 456-4564 is NOT valid cell- 212-4564-4564 is NOT valid -------- is NOT valid this is what i came up with, but it doesnt work $test="/(\d+\-?)/" Please help... Quote Link to comment https://forums.phpfreaks.com/topic/123753-validating-numbers/ Share on other sites More sharing options...
l0ve2hat3 Posted September 11, 2008 Author Share Posted September 11, 2008 any one????? Quote Link to comment https://forums.phpfreaks.com/topic/123753-validating-numbers/#findComment-639026 Share on other sites More sharing options...
effigy Posted September 11, 2008 Share Posted September 11, 2008 /^(?=.*\d)[-\d]+$/ will match numbers and hyphens only in no specific order and require a digit. P.S. Please be patient. Quote Link to comment https://forums.phpfreaks.com/topic/123753-validating-numbers/#findComment-639029 Share on other sites More sharing options...
l0ve2hat3 Posted September 11, 2008 Author Share Posted September 11, 2008 well thank you very much! Quote Link to comment https://forums.phpfreaks.com/topic/123753-validating-numbers/#findComment-639031 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.