显然,您可以使用|(管道?)来表示OR,但有没有办法表示AND?
具体来说,我想匹配包含某个短语的所有文本的段落,但没有特定的顺序.
如何在字符串中的任何位置编写正则表达式以匹配两个给定的字符串?
例如,如果我寻找cat和mat,它应该匹配:
The cat slept on the mat in front of the fire.
At 5:00 pm, I found the cat scratching the wool off the mat.
Run Code Online (Sandbox Code Playgroud)
无论在这些字符串之前是什么.