我正在尝试匹配来自html页面的<span>
标记中的端口号:
<span class="tbBottomLine" style="width:50px;">
8080
</span>
<span class = "tbBottomLine" style = "width: 50px;">
80
</ span>
<span class = "tbBottomLine" style = "width: 50px;">
3124
</ span>
<span class = "tbBottomLine" style = "width: 50px;">
1142
</ span>
脚本:
^{pr2}$但我得到的输出是:
['8', '8', '0', '0', '0', '8', '8', '0', '0', '8', '8', '8', '8', '8', '8', '8', '8', '0']
我需要它来匹配8080
例如。在
您正在重复组
([0-9]){2,}
。用最后一个值覆盖。在相反,在小组内部重复子模式:
编码
^{pr2}$如果你想把端口从页面上拉下来。在
您需要一个或多个长度至少为两个的字符({2,})。但是仍然不清楚用例是什么。在
相关问题 更多 >
编程相关推荐