Regex匹配2个单词之间的所有字符(不包括空格)

问题描述 投票:-2回答:1

示例1:

There were no issues found


Another attempt will take place in 30 minutes

示例2:

There were no issues found
Random words and numbers, this could be literally anything
Random words and numbers, this could be literally anything
Random words and numbers, this could be literally anything
Another attempt will take place in 30 minutes

问题:

RegEx中是否有任何方法可以检测单词'found'和'Another'之间是否出现任何字符?请注意,它不在1行之内,而是在多行之内。

非常感谢您的帮助。

提前谢谢您

regex nsregularexpression qregularexpression
1个回答
0
投票
found.*\S.*AnotherDOTALLs)修饰符将对其进行匹配。 DOTALL允许.匹配换行符,因此它将跨多行匹配。 \S将匹配一个非空白字符。
© www.soinside.com 2019 - 2024. All rights reserved.