I need to match with a javascript RegExp the string: bimbo999 from this a tag: <a href="/game.php?village=828&screen=info_player&id=29956" >bimbo999</a>
The numbers from URL vars (village and id) are changing every time so I have to match the numbers somehow with RegExp.
</tr>
<tr><td>Sent</td><td >Oct 22, 2011 17:00:31</td></tr>
<tr>
<td colspan="2" valign="top" height="160" style="border: solid 1px black; padding: 4px;">
<table width="100%">
<tr><th width="60">Supported player:</th><th>
<a href="/game.php?village=828&screen=info_player&id=29956" >bimbo999</a></th></tr>
<tr><td>Village:</td><td><a href="/game.php?village=828&screen=info_village&id=848" >bimbo999s village (515|520) K55</a></td></tr>
<tr><td>Origin of the troops:</td><td><a href="/game.php?village=828&screen=info_village&id=828" >KaLa I (514|520) K55</a></td></tr>
</table><br />
<h4>Units:</h4>
<table class="vis">
I tried with this:
var match = h.match(/Supported player:</th>(.*)<\/a><\/th></i);
but is not working. Can you guys, help me?
<table>
, then the appropriate<a>
tags in the table using jQuery or a cross-browser selector library like Sizzle and then just get the innerHTML of the<a>
tag to get bimbo999. – jfriend00