我有两个字符串
(' first',' second',' third',' 4th')
(' first',' second',' third',' Fifth')
并且通过这种模式我希望匹配它们,问题是当我在其中一个字符串上运行preg_match
时,我得到了整个字符串的匹配,但也只是('fourth'|'fifth')
部分的匹配。结果是
array(
[0]=>
array(
[0]=>('first', 'second', 'third', 'fourth')
[1]=>0
)
[1]=>
array(
[0]=>'fourth'
[1]=>29
)
)
有没有办法在or
条件之后不考虑单个世界?
preg_match("/\"place=\('first', 'second', 'third', ('fourth'|'fifth')\);\"/",
$string, $match, PREG_OFFSET_CAPTURE);