开发者

Validation for phone and mobile numbers

I tried it on Google but not get proper RE.will someone help me to achieve this : Phone Number: (Country Code)-(Ci开发者_如何学运维ty Code)-(Number) Mobile Number: (Country Code)-(Number)

obviously that should not take char. Please help me


This is the site for regular expression. note it down for future reference, you won't ever be dissapointed

For phone numbers: http://regexlib.com/Search.aspx?k=phone%20number

now here are some samples from there

PhoneNumbers

  • ^[2-9]\d{2}-\d{3}-\d{4}$
  • (((\d{3}) ?)|(\d{3}-))?\d{3}-\d{4}
  • (([0-9]{2}|0{1}((x|[0-9]){2}[0-9]{2})))\s*[0-9]{3,4}[- ]*[0-9]{4}

Mobiles:

  • ^[+]447\d{9}$
  • ^(+44\s?7\d{3}|(?07\d{3})?)\s?\d{3}\s?\d{3}$

Hope it helps

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜