请教如何写正则表达式
<tbody>
<tr>
<td style="border-right: 0;">
<a class="color10078be" href="http://www.cdgmgd.com/webapp/pdf/H-FK61.pdf">H-FK61</a>
</td>
<td style="border-right: 0;">
<span>1.497</span>
</td>
<td style="border-right: 0;">
<span>81.61</span>
</td>
<td>
<span>0.00609</span>
</td>
<td style="border-right: 0;">
<span>497-816</span>
</td>
<td>
<span>FCD1</span>
</td>
<td style="border-right: 0;">
<span>497816</span>
</td>
<td>
<span>N-PK52A</span>
</td>
<td style="border-right: 0;">
<span>497816</span>
</td>
<td>
<span>S-FPL51</span>
</td>
</tr>
<tr>
<td style="border-right: 0;">
<a class="color10078be" href="http://www.cdgmgd.com/webapp/pdf/H-FK61B.pdf">H-FK61B</a>
</td>
<td style="border-right: 0;">
<span>1.497</span>
</td>
<td style="border-right: 0;">
<span>81.61</span>
</td>
<td>
<span>0.00609</span>
</td>
<td style="border-right: 0;">
<span>497-816</span>
</td>
<td>
<span>FCD1B</span>
</td>
<td style="border-right: 0;">
<span>497816</span>
</td>
<td>
<span>N-PK52A</span>
</td>
<td style="border-right: 0;">
<span>497816</span>
</td>
<td>
<span>S-FPL51</span>
</td>
</tr>
<tr>
<td style="border-right: 0;">
<a class="color10078be" href="http://www.cdgmgd.com/webapp/pdf/H-K5.pdf">H-K5</a>
</td>
<td style="border-right: 0;">
<span>1.51007</span>
</td>
<td style="border-right: 0;">
<span>63.36</span>
</td>
<td>
<span>0.00805</span>
</td>
<td style="border-right: 0;">
<span>510-634</span>
</td>
<td>
<span>BSC1</span>
</td>
<td style="border-right: 0;">
<span>510635</span>
</td>
<td>
<span>BK1</span>
</td>
<td style="border-right: 0;">
<span>510636</span>
</td>
<td>
<span>BSL1</span>
</td>
</tr>
<tr>
<td style="border-right: 0;">
<a class="color10078be" href="http://www.cdgmgd.com/webapp/pdf/H-K6.pdf">H-K6</a>
</td>
<td style="border-right: 0;">
<span>1.51112</span>
</td>
<td style="border-right: 0;">
<span>60.46</span>
</td>
<td>
<span>0.008454</span>
</td>
<td style="border-right: 0;">
<span>511605</span>
</td>
<td>
<span>C7</span>
</td>
<td style="border-right: 0;">
<span>511604</span>
</td>
<td>
<span>K7</span>
</td>
<td style="border-right: 0;">
<span>511605</span>
</td>
<td>
<span>NSL7</span>
</td>
</tr>
<tr>
<td style="border-right: 0;">
<a class="color10078be" href="http://www.cdgmgd.com/webapp/pdf/H-K9L.pdf">H-K9L</a>
</td>
<td style="border-right: 0;">
<span>1.5168</span>
</td>
<td style="border-right: 0;">
<span>64.2</span>
</td>
<td>
<span>0.00805</span>
</td>
<td style="border-right: 0;">
<span>517-642</span>
</td>
<td>
<span>BSC7</span>
</td>
<td style="border-right: 0;">
<span>517642</span>
</td>
<td>
<span>N-BK7</span>
</td>
<td style="border-right: 0;">
<span>516641</span>
</td>
<td>
<span>S-BSL7</span>
</td>
</tr>
<tr>
<td style="border-right: 0;">
<a class="color10078be" href="http://www.cdgmgd.com/webapp/pdf/H-K9L_.pdf">H-K9L*</a>
</td>
<td style="border-right: 0;">
<span>1.5168</span>
</td>
<td style="border-right: 0;">
<span>64.2</span>
</td>
<td>
<span>0.00805</span>
</td>
<td style="border-right: 0;">
<span>517-642</span>
</td>
<td>
<span>BSC7</span>
</td>
<td style="border-right: 0;">
<span>517642</span>
</td>
<td>
<span>N-BK7</span>
</td>
<td style="border-right: 0;">
<span>516641</span>
</td>
<td>
<span>S-BSL7</span>
</td>
</tr>
<tr>
<td style="border-right: 0;">
<a class="color10078be" href="http://www.cdgmgd.com/webapp/pdf/H-K10.pdf">H-K10</a>
</td>
<td style="border-right: 0;">
<span>1.51818</span>
</td>
<td style="border-right: 0;">
<span>58.95</span>
</td>
<td>
<span>0.00879</span>
</td>
<td style="border-right: 0;">
<span>518-590</span>
</td>
<td>
<span>E-C3</span>
</td>
<td style="border-right: 0;">
<span></span>
</td>
<td>
<span></span>
</td>
<td style="border-right: 0;">
<span>518590</span>
</td>
<td>
<span>S-NSL3</span>
</td>
</tr>
<tr>
<td style="border-right: 0;">
<a class="color10078be" href="http://www.cdgmgd.com/webapp/pdf/H-K11.pdf">H-K11</a>
</td>
<td style="border-right: 0;">
<span>1.52638</span>
</td>
<td style="border-right: 0;">
<span>60.16</span>
</td>
<td>
<span>0.00875</span>
</td>
<td style="border-right: 0;">
<span>526-601</span>
</td>
<td>
<span>BACL1</span>
</td>
<td style="border-right: 0;">
<span>526600</span>
</td>
<td>
<span>BALK1</span>
</td>
<td style="border-right: 0;">
<span>526600</span>
</td>
<td>
<span>NSL21</span>
</td>
</tr>
</tbody>
</table>
如上一段源码,需要取href="网站">这个参数</a>以及<span>与</span>之间的所有字符(包含空字符),请问该如何写正则表达式,我写的遇到空白字符就自动跳过了,希望大神多多指点。谢谢
本帖最后由 林峰 于 2021-2-22 11:04 编辑
<tr>[\s\S]*?<td style="border-right: 0;">[\s\S]*?<a class="color10078be" href=".*?">(.*?)</a>[\s\S]*?</td>[\s\S]*?<td style="border-right: 0;">[\s\S]*?<span>(.*?)</span>[\s\S]*?</td>[\s\S]*?<td style="border-right: 0;">[\s\S]*?<span>(.*?)</span>[\s\S]*?</td>[\s\S]*?<td>[\s\S]*?<span>(.*?)</span>[\s\S]*?</td>[\s\S]*?<td style="border-right: 0;">[\s\S]*?<span>(.*?)</span>[\s\S]*?</td>[\s\S]*?<td>[\s\S]*?<span>(.*?)</span>[\s\S]*?</td>[\s\S]*?<td style="border-right: 0;">[\s\S]*?<span>(.*?)</span>[\s\S]*?</td>[\s\S]*?<td>[\s\S]*?<span>(.*?)</span>[\s\S]*?</td>[\s\S]*?<td style="border-right: 0;">[\s\S]*?<span>(.*?)</span>[\s\S]*?</td>[\s\S]*?<td>[\s\S]*?<span>(.*?)</span>[\s\S]*?</td>[\s\S]*?</tr>
https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.mp.itc.cn%2Fq_mini%2Cc_zoom%2Cw_640%2Fupload%2F20170720%2F283773d3aaff43aea862b9a5d51eabf4_th.jpg&refer=http%3A%2F%2Fimg.mp.itc.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1616553843&t=4b592ccb7f452c82db689044e65ca5fe 和空白字符没有关系,但是和空白字符所在的那一段文本格式有关系,那一段文本格式和其他的几段格式不一样,说白了就是多了几个空格 林峰 发表于 2021-2-22 11:10
和空白字符没有关系,但是和空白字符所在的那一段文本格式有关系,那一段文本格式和其他的几段格式不一样,说 ...
好的,非常感谢
页:
[1]