Regex to find two words on the page

后端 未结 5 1915
無奈伤痛
無奈伤痛 2021-01-30 11:04

I\'m trying to find all pages which contain words \"text1\" and \"text2\". My regex:

text1(.|\\n)*text2 

it doesn\'t work..

5条回答
  •  耶瑟儿~
    2021-01-30 11:31

    Adding a response for IntelliJ

    Building on @OnlineCop's answer, to swap the order of two expressions in IntelliJ,you would style the search as in the accepted response, but since IntelliJ doesn't allow a one-line version, you have to put the replace statement in a separate field. Also, IntelliJ uses $ to identify expressions instead of \.

    For example, I tend to put my nulls at the end of my comparisons, but some people prefer it otherwise. So, to keep things consistent at work, I used this regex pattern to swap the order of my comparisons:

    Notice that IntelliJ shows in a tooltip what the result of the replacement will be.

提交回复
热议问题