Community
    • Login

    Marking lines immediatelly after marked lines

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 5.6k Views 1 Watching
    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.
    • Mortaza AziziM Offline
      Mortaza Azizi
      last edited by

      hello friends, How can I mark 1 line next to the lines containing a specific word?

      1 Reply Last reply Reply Quote 0
      • guy038G Offline
        guy038
        last edited by

        Hello @mortaza-azizi,

        Not difficult with regular expressions !

        Let’s suppose we would like to mark any line containing the license string, as well as the lines just below each line which contains the license string, in the usual license.txt file, part of any N++ package :

        • Open the license.txt file in Notepad v.7.5.4

        • Open the Mark dialog ( Search > Mark… menu command )

        • Check the Bookmark line, Wrap around and Regular expresion options

        • Check the Match case option, if necessary

        • UN-check the Purge for each search option

        • Type in (?-s).*license.*, in the Find what: zone

        • Click on the Mark All button

        • Type in (?-s)license.*\R\K.*\R, in the Find what: zone

        • Click, a second time, on the Mark All button

        Et voilà !

        Notes :

        • As usual, the modifier (?-s) means that any dot character will match a single standard characters, only

        • In the first regex, the part .*license.* matches any line containing the string license

        • In the second regex, the part license.*\R matches the remaining of the line, beginning with the string license, with its End of Line chars

        • Then, the \K syntax forces the regex engine to forget any previous match

        • So, the final regex is, simply, .*\R, which matches the entire contents of the next line. Note that the \R syntax, at the end of the regex, which matches the line-break characters, is needed, when this next line is a true blank line !

        Best Regards,

        guy038

        Mortaza AziziM 1 Reply Last reply Reply Quote 0
        • Mortaza AziziM Offline
          Mortaza Azizi @guy038
          last edited by

          Hello @guy038
          Thanks for your comprehensive reply to my question.

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors