是否可以为以下模式执行单个正则表达式

问题描述 投票:0回答:1

我需要为下面的模式选择引号内的单词

I "" in XXX_PAGE
I "" and "" in XXX_PAGE
I do "" in XXX_PAGE
I do "" and "" in XXX_PAGE
I perform "" in XXX_PAGE
I perform "" and "" in XXX_PAGE
I validate "" in XXX_PAGE
I validate "" and "" in XXX_PAGE
I search for "" in XXX_PAGE
I search for "" and "" in XXX_PAGE
I search for "" or "" in XXX_PAGE
I search for "" and_or "" in XXX_PAGE

我尝试了各种最不正确的一个是..我无法分开 AND 和其他词执行搜索等 - 有人可以帮忙吗

/^I ((.*?)|(.*?) and (.*?)) in (.*?)_Page$/
node.js regex cucumber gherkin
1个回答
0
投票

您可以编写一个主要使用

XXX_PAGE
信息的表达式,例如:

(?i)(?:"([^"]*)"\s+(?:\band\b|\bor\b|\band_or\b))?\s+"([^"]*)"\s+in\s+[^_]{3}_page$
© www.soinside.com 2019 - 2024. All rights reserved.