2011-02-07 13 views
0

各プレイリストのプレイヤー数を削りたいです。値はカンマなしです。ReGex問題プレイヤー数を取得

NOBLE MAP PACK (652 Players)</span><span>&#160;</span></a></li> 

上記は「652」のリスト項目の1つです。

$c = curl_init(); 
curl_setopt_array($c, array(
    CURLOPT_URL => 'http://www.bungie.net/mobile/playlists.aspx', 
    CURLOPT_RETURNTRANSFER => true, 
    )); 
$r = curl_exec($c); 
curl_close($c); 

preg_match_all('|([\w\s]+)</a> </h4>\s*([0-9,]+) Players|s', $r, $m); 

これは、あなたが機動電話エミュレータを使用しない限り、それを表示したり、ソースを見ることができませんhttp://www.bungie.net/mobile/playlists.aspxからのソースコードです。

<!DOCTYPE html> 
<html lang="en"> 
<head><title> 

</title> 
</head> 
<body> 
<!-- 
<div id="page"> 

    <span id="pageClass"></span> 
    <div id="mainContent"> 
     <table class="breadcrumb" cellpadding="0" cellspacing="0"> 
      <tr> 
       <td><a href="/mobile/reachonline.aspx" id="reachBackLink" class="ajax">Back</a></td> 
       <td class="middle"><h3>Playlists</h3></td> 
       <td>&nbsp;</td> 
      </tr> 
     </table> 



     <ul id="arrowList"> 
       <li><a href="/mobile/playlist.aspx?cid=29898" id="playLink_0" class="bothSides ajax"><span class="bothSidesLeft">NOBLE MAP PACK (652 Players)</span><span>&#160;</span></a></li> 

       <li><a href="/mobile/playlist.aspx?cid=30228" id="playLink_1" class="bothSides ajax"><span class="bothSidesLeft">COMMUNITY SLAYER </span><span>&#160;</span></a></li> 

       <li><a href="/mobile/playlist.aspx?cid=30353" id="playLink_2" class="bothSides ajax"><span class="bothSidesLeft">GRIFBALL </span><span>&#160;</span></a></li> 

       <li><a href="/mobile/playlist.aspx?cid=30446" id="playLink_3" class="bothSides ajax"><span class="bothSidesLeft">FIREFIGHT LIMITED </span><span>&#160;</span></a></li> 

       <li><a href="/mobile/playlist.aspx?cid=30291" id="playLink_4" class="bothSides ajax"><span class="bothSidesLeft">FIREFIGHT ARCADE </span><span>&#160;</span></a></li> 

       <li><a href="/mobile/playlist.aspx?cid=25886" id="playLink_5" class="bothSides ajax"><span class="bothSidesLeft">RUMBLE PIT (2,997 Players)</span><span>&#160;</span></a></li> 

       <li><a href="/mobile/playlist.aspx?cid=29220" id="playLink_6" class="bothSides ajax"><span class="bothSidesLeft">LIVING DEAD (3,360 Players)</span><span>&#160;</span></a></li> 

       <li><a href="/mobile/playlist.aspx?cid=25885" id="playLink_7" class="bothSides ajax"><span class="bothSidesLeft">TEAM SLAYER (8,167 Players)</span><span>&#160;</span></a></li> 

       <li><a href="/mobile/playlist.aspx?cid=29978" id="playLink_8" class="bothSides ajax"><span class="bothSidesLeft">MLG (719 Players)</span><span>&#160;</span></a></li> 

       <li><a href="/mobile/playlist.aspx?cid=28808" id="playLink_9" class="bothSides ajax"><span class="bothSidesLeft">TEAM SWAT (5,936 Players)</span><span>&#160;</span></a></li> 

       <li><a href="/mobile/playlist.aspx?cid=29219" id="playLink_10" class="bothSides ajax"><span class="bothSidesLeft">TEAM SNIPERS (1,616 Players)</span><span>&#160;</span></a></li> 

       <li><a href="/mobile/playlist.aspx?cid=28474" id="playLink_11" class="bothSides ajax"><span class="bothSidesLeft">TEAM OBJECTIVE (668 Players)</span><span>&#160;</span></a></li> 

       <li><a href="/mobile/playlist.aspx?cid=28475" id="playLink_12" class="bothSides ajax"><span class="bothSidesLeft">MULTI TEAM (1,304 Players)</span><span>&#160;</span></a></li> 

       <li><a href="/mobile/playlist.aspx?cid=28476" id="playLink_13" class="bothSides ajax"><span class="bothSidesLeft">BIG TEAM BATTLE (3,625 Players)</span><span>&#160;</span></a></li> 

       <li><a href="/mobile/playlist.aspx?cid=28477" id="playLink_14" class="bothSides ajax"><span class="bothSidesLeft">INVASION (1,320 Players)</span><span>&#160;</span></a></li> 

       <li><a href="/mobile/playlist.aspx?cid=28478" id="playLink_15" class="bothSides ajax"><span class="bothSidesLeft">FIREFIGHT (1,673 Players)</span><span>&#160;</span></a></li> 

       <li><a href="/mobile/playlist.aspx?cid=28479" id="playLink_16" class="bothSides ajax"><span class="bothSidesLeft">SCORE ATTACK (429 Players)</span><span>&#160;</span></a></li> 

       <li><a href="/mobile/playlist.aspx?cid=28779" id="playLink_17" class="bothSides ajax"><span class="bothSidesLeft">CO-OP CAMPAIGN (199 Players)</span><span>&#160;</span></a></li> 

       <li><a href="/mobile/playlist.aspx?cid=28481" id="playLink_18" class="bothSides ajax"><span class="bothSidesLeft">TEAM ARENA (630 Players)</span><span>&#160;</span></a></li> 

       <li><a href="/mobile/playlist.aspx?cid=28480" id="playLink_19" class="bothSides ajax"><span class="bothSidesLeft">DOUBLES ARENA (807 Players)</span><span>&#160;</span></a></li> 

       <li><a href="/mobile/playlist.aspx?cid=30227" id="playLink_20" class="bothSides ajax"><span class="bothSidesLeft">FFA ARENA (112 Players)</span><span>&#160;</span></a></li> 
       </ul> 
    </div> 

    <div id="footer"> 

     <p>&copy; 2011 Bungie, Inc. All rights reserved.</p> 
     <ul class="nav_footer"> 
      <li class="left"><a id="mLink" href="/mobile/dl/">mobile</a></li> 
      <li class="center">&nbsp;</li> 
      <li class="right"><a id="fsLink" href="/mobile/redirect.aspx?path=%2fstats%2freach%2fplaylists.aspx">full site</a></li>   
     </ul> 
    </div> 
</div> 
--> 
</body> 
</html> 

答えて

0

この

<a[^>]*?id=\"playLink[^>]*?>.*? \(([0-9,]+) Players\) 

を使用strreplaceを使用して、後でカンマを削除します。

+0

http://www.rubular.com/r/IcYO3nF1u6 – Kaitnieks

関連する問題