[英]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.