Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Preg match PREG_MATCH在模式中找到字符?_Preg Match - Fatal编程技术网

Preg match PREG_MATCH在模式中找到字符?

Preg match PREG_MATCH在模式中找到字符?,preg-match,Preg Match,有没有一种方法可以在模式中使用找到的引用? i、 e $string='number23 cat99 dog23 car66' 例如,我想找到数字为23的单词。。。。这不起作用: preg_match('/number(\d{2}) (.*?)%1/si', $string, $new); 我不太清楚您的需要,但使用preg_match_all如何: preg_match_all('/([a-z]+23)\b/i', $string, $matches); 这将与@Biffen的numbe

有没有一种方法可以在模式中使用找到的引用? i、 e

$string='number23 cat99 dog23 car66'

例如,我想找到数字为23的单词。。。。这不起作用:

preg_match('/number(\d{2}) (.*?)%1/si', $string,  $new);

我不太清楚您的需要,但使用preg_match_all如何:

preg_match_all('/([a-z]+23)\b/i', $string, $matches);

这将与@Biffen的
number23
dog23

可能的重复项相匹配。你读过问题了吗?是的。两次。只要再读一遍,它仍然看起来像一个代码请求。要求不明确的。