示例文本:
'Times New Roman'; font-size:9pt; letter-spacing:0.05pt">test </span>
<span style="font-family:'Times New Roman'; font-size:9pt; letter-spacing:0.05pt">test </span>
<span style="font-family:'Times New Roman'; font-size:9pt; letter-spacing:0.05pt">test </span>
<span style="font-family:'Times New Roman'; font-size:9pt; letter-spacing:0.05pt">test </span>
<span style="font-family:'Times New Roman'; font-size:9pt; letter-spacing:0.05pt">6. </span>
<span style="font-family:'Times New Roman'; font-size:9pt; letter-spacing:0.05pt">Oktober </span>
<span style="font-family:'Times New Roman'; font-size:9pt; letter-spacing:0.05pt">1997</span>
<span style="font-family:'Times New Roman'; font-size:6pt; letter-spacing:0.05pt; vertical-align:super">2</span>
<span style="font-family:'Times New Roman'; font-size:9pt; letter-spacing:0.05pt">),</sp
我的正则表达式应该匹配:
<span style="font-family:'Times New Roman'; font-size:6pt; letter-spacing:0.05pt; vertical-align:super">2</span>
<span style="font-family:'Times New Roman'; font-size:9pt; letter-spacing:0.05pt">)
我的正则表达式现在是:
<span.*?>\d+?</span><span.*?>\)
结果:
<span style="font-family:'Times New Roman'; font-size:9pt; letter-spacing:0.05pt">test </span><span style="font-family:'Times New Roman'; font-size:9pt; letter-spacing:0.05pt">test </span><span style="font-family:'Times New Roman'; font-size:9pt; letter-spacing:0.05pt">test </span><span style="font-family:'Times New Roman'; font-size:9pt; letter-spacing:0.05pt">6. </span><span style="font-family:'Times New Roman'; font-size:9pt; letter-spacing:0.05pt">Oktober </span><span style="font-family:'Times New Roman'; font-size:9pt; letter-spacing:0.05pt">1997</span>***<span style="font-family:'Times New Roman'; font-size:6pt; letter-spacing:0.05pt; vertical-align:super">2</span><span style="font-family:'Times New Roman'; font-size:9pt; letter-spacing:0.05pt">)
现在已经尝试了很多,但我没有让它发挥作用
感谢您的帮助
答案 0 :(得分:1)
很难准确阅读,但请尝试:
<span[^>]*>\d+?</span>.*<span[^>]*>
通过搜索不是括号的字符,您可以更清楚地了解到的内容。我也很幸运。*围绕着无关紧要的空白区域。