慕斯卡8255803
2018-03-14 17:43
請問下面html怎樣才可獲得12557637001?我想到的是開始為(?<=bc_4)
希望指點
<ul><li><span><a href="/cell-phones-service-plans-accessories/b/ref=dp_bc_1/135-5574408-5805717?ie=UTF8&node=2335752011">
Cell Phones & Accessories
</a></span></li><li><span>
›
</span></li><li><span><a href="/cell-phone-accessories/b/ref=dp_bc_2/135-5574408-5805717?ie=UTF8&node=2407755011">
Accessories
</a></span></li><li><span>
›
</span></li><li><span><a href="/chargers-charging-cables/b/ref=dp_bc_3/135-5574408-5805717?ie=UTF8&node=2407761011">
Chargers & Power Adapters
</a></span></li><li><span>
›
</span></li><li><span><a href="/Cell-Phone-Wall-Chargers/b/ref=dp_bc_4/135-5574408-5805717?ie=UTF8&node=12557637011">
Wall Chargers
</a></span></li></ul>
$html=<<<HTML
<ul><li><span><a href="/cell-phones-service-plans-accessories/b/ref=dp_bc_1/135-5574408-5805717?ie=UTF8&node=2335752011">
Cell Phones & Accessories
</a></span></li><li><span>
›
</span></li><li><span><a href="/cell-phone-accessories/b/ref=dp_bc_2/135-5574408-5805717?ie=UTF8&node=2407755011">
Accessories
</a></span></li><li><span>
›
</span></li><li><span><a href="/chargers-charging-cables/b/ref=dp_bc_3/135-5574408-5805717?ie=UTF8&node=2407761011">
Chargers & Power Adapters
</a></span></li><li><span>
›
</span></li><li><span><a href="/Cell-Phone-Wall-Chargers/b/ref=dp_bc_4/135-5574408-5805717?ie=UTF8&node=12557637011">
Wall Chargers
</a></span></li></ul>
HTML;
$pattern = '/&node=\d+">/';
$matches = array();
$res = preg_match_all($pattern,$html,$matches);
$r = end($matches[0]);
$r = substr($r,6,-2);
echo $r;
&node=\d{11}">
鬼斧神工之正则表达式
47865 学习 · 113 问题
相似问题