解析这些数据的最佳方法是什么?我应该使用正则表达式还是其他东西?数据是 html 格式,但我是从一个网站上找到的,并且将解析这个并且只有这个字符串(注意:字符串更长 - 超过 1,300 个实例 - 下面只有两个) - 注意我使用 php 和 jquery 进行大多数 Web 编程。
我只需要提取第二个 td 中的数据,并且只提取锚内的锚文本 - 在实例 1 中,它是:Best,Jahvid DET RB
我只需要运行一次这个循环。
<tr class="oddtablerow"><td class="rank">1.</td><td class="rank">1.</td><td class="player"><a href="http://football22.myfantasyleague.com/2010/player?L=34793&P=9839" title="Salary: $2250000, Year: 3, Status: 3, Info: Drafted 10 1:04 Team, Week 3: at Vikings Sun 1:00 p.m. ET" class="position_rb">Best, Jahvid DET RB</a> (R) </td><td class="points tot">53.90</td><td class="points avg">26.950</td><td class="points"><a href="detailed?L=34793&W=1&P=9839&YEAR=2010">17.55</a></td>
<td class="points"><a href="detailed?L=34793&W=2&P=9839&YEAR=2010">36.35</a></td>
<td class="status"><a title="Owner: William Gold" class="franchise_0009" href="http://football22.myfantasyleague.com/2010/options?L=34793&F=0009&O=01">Team Name</a> - <a href="options?L=34793&O=05&FRANCHISE=0013,0009&PLAYER=9839,">Trade</a></td><td class="week">7</td><td class="salary">$2250000</td></tr>
<tr class="eventablerow myfranchise "><td class="rank">2.</td><td class="rank">2.</td><td class="player"><a href="http://football22.myfantasyleague.com/2010/player?L=34793&P=3291" title="Salary: $7400000, Year: 3, Status: 3, Info: , Week 3: at Broncos Sun 4:15 p.m. ET" class="position_qb">Manning, Peyton IND QB</a></td><td class="points tot">49.61</td><td class="points avg">24.805</td><td class="points"><a href="detailed?L=34793&W=1&P=3291&YEAR=2010">26.66</a></td>
<td class="points"><a href="detailed?L=34793&W=2&P=3291&YEAR=2010">22.95</a></td>
<td class="status"><a title="Owner: Robert M. Cavezza " class="myfranchise franchise_0013" href="http://football22.myfantasyleague.com/2010/options?L=34793&F=0013&O=01">The Bullies</a></td><td class="week">7</td><td class="salary">$7400000</td></tr>
编辑:jquery 的答案怎么了?我正要实施它,但它消失了