Phone format 正则表达式

前端之家收集整理的这篇文章主要介绍了Phone format 正则表达式前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Malaysia Phone format


"^((\\+60(\\s|-)?)|0)(((?!0)(?!2)(?!80)(?!81)\\d{1,2})[1]?)(\\s|-)?\\d{2,4}(\\s|-)?\\d{4}$"


all landline + mobile + IP in these format:

0XY YYXX XXXX or +60 XY YYXX XXXX

X must be there,Y may or not may be there depend on which number
example:
012 345 6789 or +60 12 345 6789 (normal mobile)
03 1234 5678 or +60 1234 5678 (selangor fix line)
088 12 3456 or +60 88 12 3456 (sabah fix line)
0111 123 4567 or +60 111 123 4567 (new mobile format)

space does not matter (accept without space too) or can be replace with dash (-)

do not accept bracket (common style to let people know the number can be omitted for local or STD call)
do not accept number to singapore (02),brunei (080) or any other unused NDC
do not accept NSN without trunk prefix (you don’t give people 12-345 6789)
do not accept country code + NSN without international call prefix too. it will confused people to give full number with country code without the plus sign.
do not accept input from stupid people who do not know the different between country code and trunk prefix (+6 03 1234 5678)
do not accept input from stupid people who try to separate subscribe number wrongly (+6011 123 456)


Singapure Phone format


"^[689]\\d{3}(\\s)?\\d{4}$"

原文链接:https://www.f2er.com/regex/362269.html

猜你在找的正则表达式相关文章