我想知道这里的反向引用是什么问题:
preg_match_all('/__\((\'|")([^\1]+)\1/', "__('match this') . 'not this'", $matches);
它应该与__('')之间的字符串匹配,但实际上它返回:
match this') . 'not this
有任何想法吗?
最佳答案
使您的正则表达式不满意:
preg_match_all('/__((\'|")([^\1]+)\1/U', "__('match this') . 'not this'", $matches)
关于php - 正则表达式,preg_match_all模式中的反向引用问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6050427/