• Login
Community
  • Login

Linebreak after text with number in different lengh

Scheduled Pinned Locked Moved General Discussion
3 Posts 2 Posters 295 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.
  • A
    Andi
    last edited by Nov 16, 2023, 4:00 PM

    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

    C 1 Reply Last reply Nov 16, 2023, 5:31 PM Reply Quote 1
    • C
      Coises @Andi
      last edited by Nov 16, 2023, 5:31 PM

      @Andi You want:

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

      A 1 Reply Last reply Nov 17, 2023, 9:58 AM Reply Quote 3
      • A
        Andi @Coises
        last edited by Nov 17, 2023, 9:58 AM

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

        1 Reply Last reply Reply Quote 0
        2 out of 3
        • First post
          2/3
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors