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.
    • Kyle WarrenK
      Kyle Warren
      last edited by Kyle Warren

      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
      • guy038G
        guy038
        last edited by guy038

        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
        • Makwana PrahladM
          Makwana Prahlad Banned
          last edited by

          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.

          Alan KilbornA 1 Reply Last reply Reply Quote 0
          • Alan KilbornA
            Alan Kilborn @Makwana Prahlad
            last edited by

            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
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors