[英]What is wrong with this PHP expression?
有人可以向我解释为什么以下返回空的 arrays 吗?
$reg = "/(\[{(false|true)};{.+};{\d}\])+/";
preg_match_all($reg,"[{false};{abcde};{10}][{true};{fghij};{10}]",$matches);
print_r($matches);
你已经写了\d
当它应该是\d+
:
$reg = "/(\[{(false|true)};{.+};{\d+}\])+/";
preg_match_all($reg,"[{false};{abcde};{10}][{true};{fghij};{10}]",$matches);
print_r($matches);
尽管在您的情况下似乎无关紧要,但我也会避开大括号,因为它们是特殊字符。
$reg = "/(\[\{(false|true)\};\{.+\};\{\d+\}\])+/";
\d 应该是 \d+ 一个
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.