Community
    • Login

    Linebreak after text with number in different lengh

    Scheduled Pinned Locked Moved General Discussion
    3 Posts 2 Posters 274 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.
    • AndiA
      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
        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
          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
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors