Community

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

    help about this regex

    General Discussion
    regex
    3
    5
    84
    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.
    • namx3249
      namx3249 last edited by

      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 ?

      Alan Kilborn 2 Replies Last reply Reply Quote 0
      • Alan Kilborn
        Alan Kilborn @namx3249 last edited by

        @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
        • Alan Kilborn
          Alan Kilborn @namx3249 last edited by

          @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.

          Sunade 1 Reply Last reply Reply Quote 2
          • namx3249
            namx3249 last edited by namx3249

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

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

              @Alan-Kilborn said in help about this regex:

              @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.

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