I\'m trying to find all pages which contain words \"text1\" and \"text2\". My regex:
text1(.|\\n)*text2
it doesn\'t work..
If you want the regex to match over several lines I would try:
text1[\w\W]*text2
Using .
is not a good choice, because it usually doesn't match over multiple lines. Also, for matching single characters I think using square brackets is more idiomatic than using ( ... | ... )
If you want the match to be order-independent then use this:
(?:text1[\w\W]*text2)|(?:text2[\w\W]*text1)