$subject= "Citation flow <img src='/static/images/icons/help.png'>
</span>
</p>
<p style='font-size: 150%;'><b>11</b></p>";
$pattern="/Citation flow[.]+<b>([0-9]+)<'/b>/i";
preg_match_all($pattern, $subject,$matches,PREG_PATTERN_ORDER);
print_r($matches);
我想捕获数字 11 输入粗体标签......但我的正则表达式不起作用.. 为什么?
更新:
我想出了这个..但我不是100%这是最好的解决方案:
$pattern="/Citation flow['s'S]*<b>([0-9]+)<'/b>/i";
好吧,它不能匹配,因为Citation flow
后面有一个空格,而不是任意数量的点。你可能的意思是
(?si)Citation flow.+<b>('d+)</b>
你不想要吗
$pattern="/Citation flow[.]+<b>([0-9]+)<'/b>/si";