Community
    • Login

    Given this input, how to have this output?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 2 Posters 660 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.
    • Pixels PicsP Offline
      Pixels Pics
      last edited by

      How to do this in notepad++

      spacing.jpg

      1 Reply Last reply Reply Quote 0
      • Pixels PicsP Offline
        Pixels Pics
        last edited by

        to explain further, the output just add one space without losing the column alignment between the first line and 2nd line (e.g. 111 in first line is still aligned with 111 in the second line after adding a space)

        Terry RT 1 Reply Last reply Reply Quote 0
        • Terry RT Offline
          Terry R @Pixels Pics
          last edited by

          @Pixels-Pics said in Given this input, how to have this output?:

          to explain further, the output just add one space without losing the column alignment between the first line and 2nd line (e.g. 111 in first line is still aligned with 111 in the second line after adding a space)

          This seems to be achievable using regular expressions (regex). For every character we find, we add a space to it. So using the Replace function we have:
          Find What:(?-s).
          Replace With:\x20${0}
          Set the search mode to “Regular expression”. The \x20 is code for a space, or you can just type a space in that position. I used the \x20 so you can see there is a character there.

          Using both your example and another with 2 more spaces in front of each line we get the 2 lines spaced out but still in alignment with each other.

          I haven’t completed any other tests, your work is in seeing if it solves your problem on real data. However if your data included tabs then it will NOT work.

          Terry

          Pixels PicsP 1 Reply Last reply Reply Quote 3
          • Pixels PicsP Offline
            Pixels Pics @Terry R
            last edited by

            @Terry-R Your regex works on my real-world data. As you pointed out, my data don’t have tabs. Thank you very much for your timely solution and reply.

            1 Reply Last reply Reply Quote 1

            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