The following string is part of the web page, Season number: More comments (109 in total)
dfs
Total
109
Article
All 109 items, how to use regular expressions to extract the three numbers 109, $p_search='/(.*)(S*) |(d).*/';What’s wrong with this?
$p_search='/(d ) span>/';
This is enough
(d )
$p_search='/(d ) /';
Isn’t this enough?
You need to extract all 3 109s
$s='<span class="pl">季数:<a href="http://movie.douban.com/subject/3401355/reviews">更多评论(共109条)</a> dfs<a href="http://movie.douban.com/subject/6973376/reviews">共<span property="v:count">109</span>条</a><a href="http://movie.douban.com/subject/6537486/reviews">全部 109 条</a>';$p_search='#(\d+)(</span>)?\s*条#s';preg_match_all($p_search,$s,$m);print_r($m[1]);
PHP code?123456789$s='More reviews (109 in total) dfsTotal