Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Select/mark all lines which contain a certain pattern and add the line above

    Help wanted · · · – – – · · ·
    2
    5
    152
    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.
    • sgtsixpack
      sgtsixpack last edited by

      There is already a topic but I wanted to start a new thead to “add the line above”:
      https://community.notepad-plus-plus.org/topic/14704/select-mark-all-lines-which-contain-a-certain-pattern

      I’m not sure how to copy a line using the bookmark feature yet, but I want a bookmark to be added to every line above what I have already bookmarked as a result of edit>find>mark>bookmark line>mark all.

      Alan Kilborn 1 Reply Last reply Reply Quote 0
      • Alan Kilborn
        Alan Kilborn @sgtsixpack last edited by

        @sgtsixpack said in Select/mark all lines which contain a certain pattern and add the line above:

        how to copy a line using the bookmark feature

        Search menu > Bookmark > Copy Bookmarked Lines

        I want a bookmark to be added to every line above what I have already bookmarked

        You can’t do this based solely on the bookmarks. You can, however, craft a mark search expression that will bookmark a line of interest and the line above that one.

        Alan Kilborn 1 Reply Last reply Reply Quote 3
        • Alan Kilborn
          Alan Kilborn @Alan Kilborn last edited by Alan Kilborn

          If you have already created YOURREGEX to mark data, if you want to bookmark the line it is on plus the line above, you could use a Find what box of:

          (?-s)^.*\R.*? and then append YOURREGEX to that.

          Example: Bookmark line containing foo and then line above it:

          Also: (?-s)\R.*?foo works but there will only be a bookmark on the “line above”, no red coloring of the text. I like the red coloring so I prefer the first version.

          1 Reply Last reply Reply Quote 2
          • sgtsixpack
            sgtsixpack last edited by

            I just expanded my search to include the line above, not sure if this is what you meant. I don’t know about “craft an expression”. I also have no clue about your last reply. My problem is solved though so thanks.

            Alan Kilborn 1 Reply Last reply Reply Quote 0
            • Alan Kilborn
              Alan Kilborn @sgtsixpack last edited by Alan Kilborn

              @sgtsixpack said in Select/mark all lines which contain a certain pattern and add the line above:

              I don’t know about “craft an expression”
              I also have no clue about your last reply.

              Sorry, I should have been more explicit.
              My comments were in regard to “Regular Expression” Search mode, which is typically what one is inferring when they ask “how can I manipulate data that is relative to some other data”.

              As you’ve probably discovered, you can, in Normal Search mode, bookmark the “line above” by making a selection that covers both lines, perhaps partially, and then pressing ctrl+f go get your text in the Find what box. You can then switch the Find window to the Mark tab and proceed with bookmarking.

              But if you do it that way, you aren’t truly doing “line above”, you’re doing “line of” and “line below”. :-)

              1 Reply Last reply Reply Quote 1
              • First post
                Last post
              Copyright © 2014 NodeBB Forums | Contributors