| View previous topic :: View next topic |
| Author |
Message |
Access Voice
Joined: 04 Jun 2006 Posts: 22
|
Posted: Fri Jun 23, 2006 8:50 am Post subject: Extract Words |
|
|
| Code: | <td align="right">Saudi-Arabien</td>
<td></td>
<td>Spanien</td>
</tr>
<tr class="ergebnis">
<td align="right">0</td>
<td>:</td>
<td>0</td>
</tr>
</table>
</div>
|
Thats Data i´ve cached from a Webpage....
Now i am to stupid to use regexp i think....
I want the following variables:
$team1 = "Saudi-Arabien"
$team2 = "Spanien"
$score1 = "0"
$score2 = "0"
HOW CAN I DO THIS? Plz help
THX! |
|
| Back to top |
|
 |
Garp Voice
Joined: 15 Sep 2003 Posts: 29
|
|
| Back to top |
|
 |
phab Voice
Joined: 22 Aug 2005 Posts: 12
|
Posted: Mon Jun 26, 2006 6:11 pm Post subject: |
|
|
Quick and REALLY dirty:
| Code: | #!/usr/bin/env tclsh
set output { <td align="right">Saudi-Arabien</td>
<td></td>
<td>Spanien</td>
</tr>
<tr class="ergebnis">
<td align="right">0</td>
<td>:</td>
<td>0</td>
</tr>
</table>
</div>}
regsub -all -- {<[^>]*>} $output "" output
regsub -all -- {\n} $output "" output
puts "[lindex $output 0] [lindex $output 2]:[lindex $output 4] [lindex $output 1]" |
Output:
| Code: | phab@Debian:~$ ./blahblah.tcl
Saudi-Arabien 0:0 Spanien |
|
|
| Back to top |
|
 |
|