Community
    • Login

    Linebreak after text with number in different lengh

    Scheduled Pinned Locked Moved General Discussion
    3 Posts 2 Posters 551 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.
    • AndiA Offline
      Andi
      last edited by

      Hello folks

      I don’t find a solution for my problem, so sorry for asking here.

      Input:
      I have a csv-file (Windows CR LF) with normally about 40k rows, but they are all in one line. I want to add a linebreak after ever B12345 and V12345. The number length could variate. I have ; as separator and have added “” to every entry between the separator.

      Input example:
      “B1000037”;“testtext”;“test / text”;“V1234”;“testtext2”;“test / text”;

      Expected outcome:
      “B1000037”;“testtext”;“test / text”;
      “V1234”;“testtext2”;“test / text”;

      Main reason:
      I have a csv with linebreaks from an editor and excel can’t handle this to know that is the above line because of the LF. So i had to change the rows to one line and re-linebreak them at the right position so that excel can handle them well.

      Tested replace from my side:
      I have tested the following rule:

      Find what: "B[\d{1,9}]
      Replace with: \r\n
      

      Outcome of my own test:
      It works with the linebreak but it always kills the first 2 chars like:
      “000037”;“testtext”;“test / text”;
      “234”;“testtext2”;“test / text”;

      I hope this is enough info and i’m hoping for an answer here. It could also be in two steps.

      Greetings, Andi

      CoisesC 1 Reply Last reply Reply Quote 1
      • CoisesC Offline
        Coises @Andi
        last edited by

        @Andi You want:

        Find what : ;("[BV]\d++";)
        Replace with : ;\r\n\1

        AndiA 1 Reply Last reply Reply Quote 3
        • AndiA Offline
          Andi @Coises
          last edited by

          @Coises That worked perfectly, many thx for the fast response. Have a nice day.

          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