A very hard one, but almost there!
Posted: Fri Nov 23, 2007 7:49 am
feyd | Please use
Explained:
There are 5 chunks of code that are similar. This i have already solved with this regEx:
C#
This will give me for example, these values:[/syntax]
-------------------------------------------------------------------------------------------------------
Now to my problem.
I also want to grab Starting Out Small from this: (first piece of code from the HTML above)
and i want to join it with my current regEx pattern. (This is the hard part) 
I dont think there is another way, BECAUSE there are NOT always 5 chunks of code between each of these "headers".
So i cant really grab these headers separately.
-------------------------------------------------------------------------------------------------------
If you dont understand, ill try to explain better
PS, this is of course not my site, so i cant change to code or anything.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Here's the HTML code i want to grab values from: (this code loops over and over a couple of times)
[syntax="html"]
<tr height="30">
<td colspan="3" class="tier1" align="center" style="border-right: none 1px #000;">Starting Out Small (<a class="tierlink" href="rankings.php?game=5&diff=4&song=-36&page=16&highlight=778">Rank: 778th</a>) </td>
<td colspan="7" class="tier2" style="border-left: none 1px #000;"> </td>
</tr>
<tr height="25">
<td>
<table cellspacing="0" cellpadding="0" align="center">
<tr><td align="center"><a href="javascript:openWindow('view_scores.php?user=22553&song=1412')"><span style="font-size: 0.7em">View All</span></a></td></tr>
</table>
</td>
<td align="center">3</td><td align="center">Slow Ride</td><td align="center"><a href="rankings.php?game=5&diff=4&song=1412&page=18&highlight=892" class="rank3">892nd</a></td>
<td align="center">192,601</td>
<td align="center"><img src="/images/rating_6.gif" /> (6.7)</td>
<td align="center"><span class="percent2">99%</span></td>
<td align="center">267</td>
<td align="center">Nov. 18, 2007, 3:19PM</td>
<td align="center"><span class="gray">N/A</span>
</tr>
<tr height="25">
<td>
<table cellspacing="0" cellpadding="0" align="center">
<tr><td align="center"><a href="javascript:openWindow('view_scores.php?user=22553&song=1428')"><span style="font-size: 0.7em">View All</span></a></td></tr>
</table>
</td>
<td align="center">3</td><td align="center">Talk Dirty to Me</td><td align="center"><a href="rankings.php?game=5&diff=4&song=1428&page=15&highlight=709" class="rank3">709th</a></td>
<td align="center">298,732</td>
<td align="center"><img src="/images/rating_6.gif" /> (6.7)</td>
<td align="center"><span class="percent2">99%</span></td>
<td align="center">358</td>
<td align="center">Nov. 18, 2007, 3:32PM</td>
<td align="center"><span class="gray">N/A</span>
</tr>
<tr height="25">
<td>
<table cellspacing="0" cellpadding="0" align="center">
<tr><td align="center"><a href="javascript:openWindow('view_scores.php?user=22553&song=1444')"><span style="font-size: 0.7em">View All</span></a></td></tr>
</table>
</td>
<td align="center">3</td><td align="center">Hit Me With Your Best Shot</td><td align="center"><a href="rankings.php?game=5&diff=4&song=1444&page=18&highlight=868" class="rank3">868th</a></td>
<td align="center">166,643</td>
<td align="center"><img src="/images/rating_6.gif" /> (6.6)</td>
<td align="center"><span class="percent2">97%</span></td>
<td align="center">181</td>
<td align="center">Nov. 18, 2007, 3:39PM</td>
<td align="center"><span class="gray">N/A</span>
</tr>
<tr height="25">
<td>
<table cellspacing="0" cellpadding="0" align="center">
<tr><td align="center"><a href="javascript:openWindow('view_scores.php?user=22553&song=1460')"><span style="font-size: 0.7em">View All</span></a></td></tr>
</table>
</td>
<td align="center">2</td><td align="center">Story of My Life</td><td align="center"><a href="rankings.php?game=5&diff=4&song=1460&page=19&highlight=914" class="rank3">914th</a></td>
<td align="center">357,933</td>
<td align="center"><img src="/images/rating_6.gif" /> (6.5)</td>
<td align="center"><span class="percent2">99%</span></td>
<td align="center">211</td>
<td align="center">Nov. 10, 2007, 4:44PM</td>
<td align="center"><span class="gray">N/A</span>
</tr>
<tr height="25">
<td>
<table cellspacing="0" cellpadding="0" align="center">
<tr><td align="center"><a href="javascript:openWindow('view_scores.php?user=22553&song=1476')"><span style="font-size: 0.7em">View All</span></a></td></tr>
</table>
</td>
<td align="center">2</td><td align="center">Rock and Roll All Nite</td><td align="center"><a href="rankings.php?game=5&diff=4&song=1476&page=17&highlight=815" class="rank3">815th</a></td>
<td align="center">162,133</td>
<td align="center"><img src="/images/rating_6.gif" /> (6.0)</td>
<td align="center"><span class="percent2">94%</span></td>
<td align="center">161</td>
<td align="center">Nov. 8, 2007, 12:11PM</td>
<td align="center"><span class="gray">N/A</span>
</tr>
There are 5 chunks of code that are similar. This i have already solved with this regEx:
C#
Code: Select all
new Regex(@"\('view_scores.php\?user=.*?&song=.*?'\)"">[\S\s]*?<td align=""center"">.*?</td>[\S\s]*?<td align=""center"">(.*?)</td>[\S\s]*?<td align=""center"">(.*?)</td>[\S\s]*?<td align=""center"">(.*?)</td>[\S\s]*?<td align=""center"">(.*?)</td>[\S\s]*?<td align=""center"">(.*?)</td>[\S\s]*?<td align=""center"">(.*?)</td>", RegexOptions.Multiline);Code: Select all
Rock and Roll All Nite
815th
162,133
<img src="/images/rating_6.gif" /> (6.0)
<span class="percent2">94%</span>
161Now to my problem.
I also want to grab Starting Out Small from this: (first piece of code from the HTML above)
Code: Select all
<tr height="30">
<td colspan="3" class="tier1" align="center" style="border-right: none 1px #000;">Starting Out Small (<a class="tierlink" href="rankings.php?game=5&diff=4&song=-36&page=16&highlight=778">Rank: 778th</a>) </td>
<td colspan="7" class="tier2" style="border-left: none 1px #000;"> </td>
</tr>I dont think there is another way, BECAUSE there are NOT always 5 chunks of code between each of these "headers".
So i cant really grab these headers separately.
-------------------------------------------------------------------------------------------------------
If you dont understand, ill try to explain better
PS, this is of course not my site, so i cant change to code or anything.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]