• Login
Community
  • Login

help about this regex

Scheduled Pinned Locked Moved General Discussion
regex
6 Posts 4 Posters 353 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.
  • N
    namx3249
    last edited by Apr 20, 2023, 3:12 PM

    hi everybody,

    i’ve make my first simply regex
    find: (?-s)(.*\r?\n){5}\K
    replace: \n\n\n

    this code insert 3 blank lines each 5 text lines
    but need to have the caret at the at the beginning of the first line of entire document … when i run another macro i have the caret to EOF and regex does not work
    so, how to edit this regex to work also with caret on EOF ?

    A 2 Replies Last reply Apr 20, 2023, 3:19 PM Reply Quote 0
    • A
      Alan Kilborn @namx3249
      last edited by Apr 20, 2023, 3:19 PM

      @namx3249 said in help about this regex:

      replace: \n\n\n

      Be careful, there…you may not get the line-endings you truly want…or maybe you will; not sure of your intention.

      1 Reply Last reply Reply Quote 1
      • A
        Alan Kilborn @namx3249
        last edited by Apr 20, 2023, 3:22 PM

        @namx3249 said in help about this regex:

        how to edit this regex to work also with caret on EOF ?

        You can’t build the “starting point” into the find expression.
        If you want to do the whole document at once (top to bottom), then checkmark Wrap around and use Replace All.

        If it is to be part of a macro, putting Ctrl+Home in the macro before the replacement is also an option, I suppose.

        S 1 Reply Last reply May 16, 2023, 7:13 PM Reply Quote 2
        • N
          namx3249
          last edited by namx3249 Apr 20, 2023, 4:32 PM Apr 20, 2023, 4:32 PM

          oh nice !
          Wrap around solved my issue.
          thank you for the tip, Alan

          K 1 Reply Last reply Jun 13, 2023, 7:29 AM Reply Quote 1
          • S
            Sunade @Alan Kilborn
            last edited by May 16, 2023, 7:13 PM

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • K
              Kiren @namx3249
              last edited by Jun 13, 2023, 7:29 AM

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors