• Login
Community
  • Login

Searching two words on different lines

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
4 Posts 4 Posters 1.3k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K
    Kyle Warren
    last edited by Kyle Warren Jul 9, 2020, 8:30 AM Jul 9, 2020, 8:29 AM

    Hi,

    I need to search for the word new_task and the word task_pending which is supposed to be 3 lines after new_task. How can i do this? Thanks for any help.

    1 Reply Last reply Reply Quote 0
    • G
      guy038
      last edited by guy038 Jul 9, 2020, 9:25 AM Jul 9, 2020, 9:24 AM

      Hello, @kyle-warren and All,

      Not difficult with regular expressions !

      Two possibilities :

      • The first regex (?-si)new_task(.+\R){3}.*task_pending searches for the range of any character between the two strings new_task and task_pending, with that exact case

      • The second regex (?-si)^.*new_task(.+\R){3}.*task_pending.*\R? searches for the complete block of 4 lines containing, both, the strings new_task and task_pending, with this exact case

      Best Regards

      guy038

      1 Reply Last reply Reply Quote 1
      • M
        Makwana Prahlad Banned
        last edited by Jul 10, 2020, 8:39 AM

        Hello,@Kyle-Warren

        Please follow this information,To Searching two words on different lines

        You need a new version of notepad++. Looks like old versions don’t support |.

        Note: egrep “CAT|TOWN” will search for lines containing CATOWN. (CAT)|(TOWN) is the proper or extension (matching 1,3,4). Strangely you wrote and which is btw (CAT.*TOWN)|(TOWN.*CAT)

        I hope this information will be useful for you.
        Thank you.

        A 1 Reply Last reply Jul 10, 2020, 11:57 AM Reply Quote 0
        • A
          Alan Kilborn @Makwana Prahlad
          last edited by Jul 10, 2020, 11:57 AM

          Like most of @Makwana-Prahlad 's posts, this one deeply confuses me.

          You need a new version of notepad++. Looks like old versions don’t support |.

          Misinformation, unless by “old” you mean pre-6.0.
          But why would you assume OP is using a really old version anyway – the OP didn’t say what version, but…

          egrep

          What does that have to do with anything??

          egrep “CAT|TOWN” will search for lines containing CATOWN.

          What does that have to do what the OP is needing to do?

          I could pick apart the rest of the posting, but it is getting tiring.
          Just please, don’t spread misinformation.

          1 Reply Last reply Reply Quote 0
          2 out of 4
          • First post
            2/4
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors