我的正则表达式有一个小问题,我用它来从强项中提取电话号码
<?php
$output = "here 718-838-3586 there 1052202932 asdas dasdasd 800-308-4653 dasdasdasd 866-641-6949800-871-0999";
preg_match_all('/\b[0-9]{3}\s*[-]?\s*[0-9]{3}\s*[-]?\s*[0-9]{4}\b/',$output,$matches);
echo '<pre>';
print_r($matches[0]);
?>
输出
Array
(
[0] => 718-838-3586
[1] => 1052202932
[2] => 800-308-4653
[3] => 866-641-6949
[4] => 800-871-0999
)
这工作正常,但它返回 1052202932 作为我不需要的结果之一。
实际上我不知道我的模式中缺少的部分在哪里。