Home > Article > Backend Development > How to extract numbers from a web page?
The following string is part of the web page, 73765ba67e0bf744033b5f4661922847Season number:37bfb51c7a92c9eb3c342e3f21ec17bf More comments (109 in total)5db79b134e9f6b82c0b36e0489ee08ed
dfs38b7b115160dbbac0c326aa05f7ff72c
Total
e6759ad96e5a04a441b14b465ae277d610954bdf357c58b8a65c66d7c19c8e4d114
Article
5db79b134e9f6b82c0b36e0489ee08edcde686c4dd5bef3d9d501ded9ae26b59 All 109 items5db79b134e9f6b82c0b36e0489ee08ed, how to use regular expressions to extract the three numbers 109, $p_search='/6e27af6592837e834855ba8d07c0ac72(.*)(S*) |(d).*5db79b134e9f6b82c0b36e0489ee08ed/';What’s wrong with this?
$p_search='/e6759ad96e5a04a441b14b465ae277d6(d )d6d448110e0324953b5d7bc1e2b276ce/';
This is enough
(d )
$p_search='/e6759ad96e5a04a441b14b465ae277d6(d ) 54bdf357c58b8a65c66d7c19c8e4d114/';
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='