代码
<td><span class="user "><i class="arrived" title="Провинциалист"></i><a href="/player/154646/">-Ваня-</a><span class="level">[5]</span></span></td>
<td class="value"></td>
<td><span class="user "><i class="arrived" title="Провинциалист"></i><a href="/player/174078/">asen</a><span class="level">[6]</span></span></td>
<td class="value"></td>
<td><span class="user "><i class="arrived" title="Провинциалист"></i><a href="/player/198745/">jsan</a><span class="level">[7]</span></span></td>
<td class="value"></td>
<td><span class="user "><i class="arrived" title="Провинциалист"></i><a href="/player/1698735/">aseto</a><span class="level">[8]</span></span></td>
<td class="value"></td>`
如何在“级别”&gt; [“并且如果数字>&gt; = 6且&lt; 8然后在此之前的同一行上执行preg_match,我该如何做和第一次preg_match
数字,例如第一个preg_match
级别“&gt; [6]并看到它等于然后在播放器上制作preg_match
并且看到该数字是”174078“
答案 0 :(得分:0)
对于给定的HTML,您可以使用类似
的内容/<a.*href="(.*?)".*"level">\[[67]\]/
但这真的很难看。我更喜欢使用XPath来grep HTML元素:http://php.net/manual/de/class.domxpath.php