特定的电话号码RegEX [英] A specific Phone Number RegEX

查看:70
本文介绍了特定的电话号码RegEX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
用于电话号码验证的综合正则表达式

Possible Duplicate:
A comprehensive regex for phone number validation

问候,

我需要对包含电话号码的文本字段实施基于jquery的验证,因为我需要这两个字符串的正则表达式,所以我要求这样做,因为我对RegEx非常幼稚:

I need to implement a jquery based validation for a text field that contains a phone number, for that I need the regular expression of these two strings, I am requesting this because I am very naive with RegEx:

第一个:

0(5NN) NNN NN NN

第二个:

0(53N) NNN NN NN 

N表示0-9之间的整数

N means an integer between 0-9

推荐答案

^0\(5\d{2}\) ?\d{3} ?\d{2} ?\d{2}$

^0\(53\d\) ?\d{3} ?\d{2} ?\d{2}$

将匹配.如果您确定在书写它们的地方总会有空格,则可以删除?.

will match. You can drop the ? if you are sure that there will always be space characters in the places you wrote them.

这篇关于特定的电话号码RegEX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆