我正在使用 RegEx 来验证用户电话号码。我对电话号码验证有一套要求。我对 RegEX 没有太多想法。任何人都可以帮助我为我的要求提供匹配的 reqex。这里的验证非常简单。
条件
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
谢谢