我正在使用正则表达式验证用户的电话号码。我有一组电话号码验证要求,但对正则表达式并不了解。请问是否有人能够帮助我提供一个匹配我的要求的正则表达式?这里的验证非常简单。
条件
1. It should allow numbers from 0-9.
2. It should allow + sign. (+ sign is not mandatory but not allow after even a single letter (ie: should be placed at front.)).
3. It should allow - sign. (- sign is also not mandatory and can be placed anywhere)
4. It should allow empty space everywhere.
5. No dots or no other chars allowed except the above said things.
正确的值
+65-12345678
65-12345678
6512345678
65 12345678
65 123 45678
65 123-45678
+65 123-45678
1234
错误的值
12345+86666
123alpha
谢谢