【发布时间】:2019-10-22 20:37:06
【问题描述】:
我正在尝试编写一个 xpath,它选择包含以数字结尾并用大括号括起来的文本的所有元素。数字可以是任何数字,也可以是任意位数。这在 XPath1.0 中可行吗?我不能使用正则表达式,因为它在 XPath1.0 中是不允许的
<div class = '12345' >
<div class = '98231'>I want this (101)</div>
<div class = '98232'>I don't want this 101</div>
<div class = '98233'>I want this (1)</div>
<div class = '98234'>I don't want this (10A1)</div>
</div>
【问题讨论】:
-
您能分享您为解决问题而编写的代码吗?
-
您只能获取所有元素,然后使用您的代码绑定通过正则表达式进行过滤。