頁面一部份如下:
<tr>
<th >落札者 </th>
<td>: </td>
<td>
by2***** / 評価:781 <br>
</td>
</tr> $html = file_get_contents('http://page5.auctions.yahoo.co.jp/jp/auction/e99459395');
preg_match_all($mode,$html,$value1);
print_r($value1);
echo $value1[1][0]; 通過正則來獲取by2*****(也可能是其他的文字,但是模式都是3個字母加5個*),怎麼寫$mode呢,這個$mode要能匹配所有的這種模式的字符串
<tr>
<th >落札者 </th>
<td>: </td>
<td>
by2***** / 評価:781 <br>
</td>
</tr> $html = file_get_contents('http://page5.auctions.yahoo.co.jp/jp/auction/e99459395');
preg_match_all($mode,$html,$value1);
print_r($value1);
echo $value1[1][0]; 通過正則來獲取by2*****(也可能是其他的文字,但是模式都是3個字母加5個*),怎麼寫$mode呢,這個$mode要能匹配所有的這種模式的字符串
http://topic.csdn.net/u/20100104/15/25800545-3559-4c1d-9e8a-13042faafd60.html
<tr>
<th >落札者 </th>
<td>: </td>
<td>
by2***** / 評価:781 <br>
</td>
</tr>
HTML;$mode = '/(\w{3}\*{5})/i';
preg_match_all($mode,$html,$value1);
print_r($value1); //Array ( [0] => Array ( [0] => by2***** ) [1] => Array ( [0] => by2***** ) )
echo $value1[1][0]; //by2*****