我花了大量时间尝试为以下xpath创建所需的正则表达式:
//button[(@*[normalize-space()='concat('Let', "'", "s have fun!")' or text()[normalize-space()='concat('Let', "'", "s have fun!")')]|//input[@*[normalize-space()='concat('Let', "'", "s have fun!")' or text()[normalize-space()='concat('Let', "'", "s have fun!")']结果应该如下所示-->连接不应该包含在‘’中。
//button[(@*[normalize-space()=concat('Let', "'", "s have fun!") or text()[normalize-space()=concat('Let', "'", "s have fun!"))]|//input[@*[normalize-space()=concat('Let', "'", "s have fun!") or text()[normalize-space()=concat('Let', "'", "s have fun!")]因此,我必须找到文本的这一部分:concat('Let', "'", "s have fun!"),然后应用matcher --> concat('Let', "'", "s have fun!")
我知道我的regexp应该类似于:
(=')((concat\()([\'|\"].+[\'|\"]))(\)')$对于concat函数的内部文本,以='开头,然后是concat(,然后是some expression (在这里我遇到了问题),然后表达式应该以)'结束
但是由于某些原因,我的正则表达式就是不能工作!
你介意给我解释一下我的问题吗?
发布于 2015-06-21 21:05:57
要匹配concat('Let', "'", "s have fun!"),您可以使用:
"concat\\(['\"].*?['\"],\\s*['\"].*?['\"],\\s*['\"].*?['\"]\\)"
https://stackoverflow.com/questions/30964435
复制相似问题