I need a simple javascript regex to validate phone numbers.
Only digits, “+” at the beginning and “-”
Max and min length of digits should be 10 – 12
The next phones should be allowed:
1. +380631505624
2. 0631505624
3. 063-15-05-624
The next phones should be NOT allowed:
1. +38063+1505624
2. asd0631505624
3. -063-15-05-624-
4. +0—3-1–24
The Comment of Quentin is the way to go, but a Regex – Expression for your needs could be:
I hope it helps, or is atleast a point in the right direction
It all depends on how save/strict you want to check
BTW.: is javascript ist would look something like this
Here you can find a working demo( On JsFiddler ) tested wit Chrome 24+
(with all numbers of your question)