以下の html から part#1AMTB00186 の各インスタンスの特定の修飾子を取得しようとしています。戻る必要が4cyl 2.3L - F23A1, Balance Shaft
あり4cyl 2.3L - F23A1, CAM
ます。私の正規表現は貪欲だと思いますが、貪欲でないようにする方法がわかりません。の最初の修飾子が常に表示されます2.3L L4, Engine-F23A1
。私は使っている:
partno="1AMTB00186";
$pattern_short ='{<td\s+class="qualifier"\s*>.*<div>([^<]+)</div>.*' . $partno . '}sU';
$matchcount = preg_match_all($pattern_short, $data, $matches);
<tr>
<tr id="61" class="findme">
<td class="productName">
<h3>Air and Fuel Delivery - Fuel Pumps and Related Components</h3>
<br>Electric Fuel</td>
<td class="qualifier"><div>2.3L L4, Engine-F23A1</div></td>
<td class="partNum">1AMFP00020</td>
</tr>
<tr id="62" class="odd findme">
<td class="productName">
<h3>Air and Fuel Delivery - Fuel Pumps and Related Components</h3>
<br>Electric Fuel</td>
<td class="qualifier"><div>3.0L V6, Engine-J30A1</div></td>
</tr>
<tr id="63" class="findme">
<td class="productName">
<h3>Belts - Timingbelts</h3>
<br>Timingbelt</td>
<td class="qualifier"><div>4cyl 2.3L - F23A1, Balance Shaft</div></td>
<td class="partNum">1AMTB00186</td>
</tr>
<tr id="64" class="odd findme">
<td class="productName">
<h3>Belts - Timingbelts</h3>
<br>Timingbelt</td>
<td class="qualifier"><div>4cyl 2.3L - F23A1, CAM</div></td>
<td class="partNum">1AMTB00244</td>
</tr>
</tr>
<tr id="63" class="findme">
<td class="productName">
<h3>Belts - Timingbelts</h3>
<br>Timingbelt</td>
<td class="qualifier"><div>4cyl 2.3L - F23A1, CAM</div></td>
<td class="partNum">1AMTB00186</td>
</tr>
<tr id="65" class="findme">
<td class="productName">
<h3>Belts - Timingbelts</h3>
<br>Timingbelt</td>
<td class="qualifier"><div>V6 3.0L - J30A1, CAM</div></td>
<td class="partNum">1AMTB00286</td>
</tr>
<tr id="66" class="odd findme">
<td class="productName">
<h3>Brakes - Disc Brake Pad and Hardware Kit</h3>
<br>Front; 7345-D465 Ceramic</td>
<td class="qualifier"><div>L4 2.3L</div></td>
<td class="partNum">1AMV300465</td>
</tr>
ありがとうございました