有一个代码,它将比较使用机器人框架访问url时产生的cookie模式,并使用字符串变量。
REGMATCH
${string}= set variable hgf
${matches}= get regexp matches ${string} asdfhgfpoyrjgrrhkjhoolk
should be equal as strings ${matches} hgf但这是假的,
我试过下面这个,
Get Lines Matching Pattern Matching Some Lines
Test Get Lines Matching Pattern asdfhgfpoyrjgrrhkjhoolk ?????? hgf
***KEYWORD***
Test Get Lines Matching Pattern
[Arguments] ${input} ${pattern} ${expected} ${case-insensitive}=no
${actual} = Get Lines Matching Pattern ${input} ${pattern} ${case-insensitive}
Should Be Equal ${actual} ${expected}有人能帮我这个忙吗。
发布于 2020-12-10 07:06:05
${actual} = Get Lines Matching Pattern ${input} ${pattern} ${case-insensitive}您的模式是?????,这意味着输入的字符恰好超过5个字符。
asdfhgfpoyrjgrrhkjhoolk可以用这么多“?”是什么?请使用glob格式的一个字符,您可以使用
${actual} = Get Lines Matching Pattern ${input} * ${case-insensitive}意思是整个字符串
对于您的y=use案例,可以使用
Should Match Regexp hithsihdisdh hsdaasidh 123 dfsdfdsf 123这将检查字符串是否有"123“。此关键字来自Builin库
Library BuiltIn下面的示例显示了每个关键字的正确用法:
*** Setting ***
Library String
Library BuiltIn
Library Selenium2Library
*** Test Cases ***
Example Search
[Tags] you probably do not have this many tags in real life
${first} = Catenate SEPARATOR=\n Not in second Same stuff Differs Same
#this is use ful to find line the pattern
${a}= Get Lines Matching Pattern ${first} Same* case_insensitive=true
#this match the entire multi line string has any match
${b}= Should Match Regexp ${first} Same
#this gives a list of all matches
${c}= Get Regexp Matches ${first} Same
Log ${a}
Log ${b}
Log ${c}https://stackoverflow.com/questions/65228946
复制相似问题