I am validating a field which may NOT be anything but numbers, but may include a space or a minus-sign.
This is for validating phone number field! So, these criterias should be met: (might have forgot a criteria, if so remind me)
1- Atleast 5 numbers
2- May contain space
3- Not shorter than 5 characters
4- Not longer than 20 characters
5- May contain minus-sign
6- Not empty
if (nr.length>4 && nr.length<21 && nr!=''){
}
How should I write the regexp? Or the if statement?
Thanks