regular expression for phone number
Is the above regular expression will work for the following string?:
I am trying to do regular expression for phone number and by that I mean every string that including only number and the "-" char.
but I don't want the "-" to appear in the beginning.
Last edited by programAngel; 05-28-2012 at 02:04 AM.
Reason: regular expression,
use [code]YOUR CODE GOES HERE[/code] or burn in Hell
This tests onePhoneNumber beginning with a digit followed by one or more digits or hyphen.
/^\d[\d-]+$/.test(onePhoneNumber) // will be true for a valid phone number
But with more precision, you must be able to make better, as for example with these post codes...
Last edited by 007Julien; 05-28-2012 at 07:07 AM.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)