PHP:如何为 PT Mobile 手机创建 preg_match() 的正则表达式?
我对 PHP 上的 Regexp 比较新...
我需要创建一个 Regexp 来过滤葡萄牙手机,有人可以帮助我并解释我是如何做到的吗? (据我了解)
规则:
The integer/string must have 9chars;
The first char must be a '9';
The second one can be '1,2,3,6' (Chars are separeted by commas);
The other chars must be in range of '0-9';
i'm newer related to Regexp on PHP...
I need to create an Regexp to filter Portuguese Mobile Phones, can anybody help me and explain how i do it? (To i understand it)
Rules:
The integer/string must have 9chars;
The first char must be a '9';
The second one can be '1,2,3,6' (Chars are separeted by commas);
The other chars must be in range of '0-9';
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
应该可以了;)
说明:
使用:如果您想检查某个电话号码是否是有效的电话号码,请使用:
注意
^
和$
。这些确保只有电话号码而没有其他内容。That should do it ;)
Explanation:
Use: If you want to check whether something is a valid phone number, use:
Notice the
^
and$
. These ensure there is only the phone number and nothing more.