Php 预匹配回溯错误

Php 预匹配回溯错误,php,regex,preg-match,Php,Regex,Preg Match,当我使用正则表达式时,(.*)*[0]一切正常: preg_match('/(.*)*[0]/', 'this is a test string'); var_dump(preg_last_error()); // no code's returned 但当我向char类添加另一个字符时,它将抛出错误: preg_match('/(.*)*[01]/', 'this is a test string'); var_dump(preg_last_error()); // int(2) 代码#2

当我使用正则表达式时,
(.*)*[0]
一切正常:

preg_match('/(.*)*[0]/', 'this is a test string');
var_dump(preg_last_error()); // no code's returned
但当我向char类添加另一个字符时,它将抛出错误:

preg_match('/(.*)*[01]/', 'this is a test string');
var_dump(preg_last_error()); // int(2)

代码#2表示PREG\u BACKTRACK\u LIMIT\u ERROR。在这里,一个额外的字符可以做什么?

(.*)
有什么意义?它会无限地寻找新的空字符串吗?@Cthulhu这只是一种测试case@stema:是的,我迫不及待地完成了解释。我会让链接来解释细节,因为一个段落没有足够的空间来解释这个概念。