Blogger Information
Blog 250
fans 3
comment 0
visits 321723
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
如何用正则表达式匹配手机号
梁凯达的博客
Original
1351 people have browsed it

 //$preg = '/^(\a{3}\d{4}\d{4})/';
 //$str = '183251651'21651651132;
 //echo preg_replace($preg,'\1***\2',$str);
 //手机号
 //十一位数
 //第一位数必须是1开头
 //30-39 47 50-59 70-79 80-89 99 98
 $preg = '/^1([3578]\d|47|99|98)\d{8}$/';
 $str = '13523131234';
 $result = preg_match($preg,$str,$arr);
 var_dump($result);
 var_dump($arr);


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post