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... 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????? 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. 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! Link to comment https://forums.phpfreaks.com/topic/123753-validating-numbers/#findComment-639031 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.