Community
    • Login

    Move character to end of previous line

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 3.5k 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.
    • Darren BrownD Offline
      Darren Brown
      last edited by

      Hi. I’m trying to move the pipe on the new line to the end of the previous line, for example -

      233307|35|ABCD|00001111|01/03/2016|||n|n|AB/123456
      |
      233307|36|ABCD|00002222|01/03/2016|||n|n|AB/123456
      |
      233307|37|DCBAL|00003333|01/03/2016|||n|n||
      

      to -

      233307|35|ABCD|00001111|01/03/2016|||n|n|AB/123456|
      233307|36|ABCD|00002222|01/03/2016|||n|n|AB/123456|
      233307|37|DCBAL|00003333|01/03/2016|||n|n||
      

      I can search for the pipe at the start of a new line with ^\s*| but can’t figure out what syntax to use for the replace to move it up to the end of the previous line. Any help would be greatly appreciated. Thanks

      gerdb42G 1 Reply Last reply Reply Quote 0
      • gerdb42G Offline
        gerdb42 @Darren Brown
        last edited by

        @darren-brown
        You need to modify your regex to include the preceding line break: \R\s*\|$. If you replace this with | you will get your desired result. Note that I also escaped the | since it has special meaning in regexes. This is a quick-and-dirty shot, there are more elaborate approaches.

        Darren BrownD 1 Reply Last reply Reply Quote 2
        • Darren BrownD Offline
          Darren Brown @gerdb42
          last edited by

          @gerdb42 said in Move character to end of previous line:

          \R\s*|$

          Brilliant, I’ve just tested and it works perfectly. Thanks for the quick response.

          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