• Login
Community
  • Login

Given this input, how to have this output?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
4 Posts 2 Posters 324 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.
  • P
    Pixels Pics
    last edited by Oct 2, 2022, 3:01 PM

    How to do this in notepad++

    spacing.jpg

    1 Reply Last reply Reply Quote 0
    • P
      Pixels Pics
      last edited by Oct 2, 2022, 3:21 PM

      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)

      T 1 Reply Last reply Oct 2, 2022, 6:26 PM Reply Quote 0
      • T
        Terry R @Pixels Pics
        last edited by Oct 2, 2022, 6:26 PM

        @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

        P 1 Reply Last reply Oct 3, 2022, 1:39 PM Reply Quote 3
        • P
          Pixels Pics @Terry R
          last edited by Oct 3, 2022, 1:39 PM

          @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
          1 out of 4
          • First post
            1/4
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors