Home >Backend Development >PHP Tutorial >这个该如何写?

这个该如何写?

WBOY
WBOYOriginal
2016-06-13 10:28:46934browse

这个该怎么写??
$a = '+86-021-13512345678转(0755)82382022&a0755-99999999mp;nb+8613812345678sp; 82382044/34';

preg_match_all('/[\d\()\+\-\s]+/',$a,$r);

print_r($r);

现在已经能提取数字了。。可是怎么能限制下,区号是3位数呀,后边电话位数是8位的呢??

------解决方案--------------------
是要限制还是要取。。。要取0755的075?还是755?

\d\d{3}-\d{8} 

\d{3}\d-\d{8}

Statement:
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
Previous article:php 稿件分页Next article:php显示经验值的有关问题