我有一个preg_match匹配特定模式,但它只是不匹配我试图匹配的模式。我究竟做错了什么?使用preg_match来匹配这个特定模式
<?php
$string = "tell me about cats";
preg_match("~\b(?:tell me about|you know(?: of| about)?|what do you think(?: of| about)?|(?:what|who) is|(?:whats|whos)) ((?:[a-z]+){1,2})$~", $string, $match);
print_r($match);
?>
预期结果:
阵列(0 =>告诉我1 =>猫)
实际结果:
阵列()
https://regex101.com/r/cN8yO2/1在右手边是什么意思的一切解释。 – Mike
有用的工具:[http://regexr.com/](http://regexr.com/) –