Home > php教程 > PHP源码 > body text

电话号码正则表达式

WBOY
Release: 2016-06-08 17:26:16
Original
1033 people have browsed it

下面提供了二种电话号码正则表达式一种是js电话号验证与一款是php验证电话号的正则表达式实例。

<script>ec(2);</script>
 代码如下 复制代码
function funcphone($str)//电话号码正则表达式
{
 return (preg_match("/^(((d{3}))|(d{3}-))?((0d{2,3})|0d{2,3}-)?[1-9]d{6,8}$/",$str))?true:false;

//js 电话号码正则表达式

 代码如下 复制代码
regexps教程.isphone = /^(((d{2,3}))|(d{3}-))?((0d{2,3})|0d{2,3}-)?[1-9]d{6,7}(-d{1,4})?$/;
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!