php preg_match_all numbers in parentheses

落花浮王杯 提交于 2019-11-28 14:29:13

How about:

preg_match_all("/\((\d+)\)/", $html, $matches, PREG_PATTERN_ORDER); 
print_r($matches[1]);

I see two possible issues.

First you are matching from start(^) to end($) it it will only match what fits exactly between start of line and end of line.

Second, you most likely want to use the /gs regex paramter to slurp it all in.

preg_match_all("/\b(\d+)\b/gs" ...
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!