How do I merge two or more consecutive lines into one?



  • Hello, Vasile,

    Ah, yes ! Quite weird ! From your print screen pictures, everything seems OK : We, both, have the same fields and options and, from the status bar, our encoding and line breaks are also identical !!??

    Moreover, I verified that the Glossar’s text, inserted in your new tab, does have the same displaying than my text ! This implies that you correctly inserted the tabulation characters ( of 4 spaces characters, by default, like me ) !!??

    So, the only thing that could explain the search failure should be, that you, probably, inserted some invisible character(s) in the search regex ?

    But, I must admit that I’m really annoyed to not being able to point out the true reason of your N++'s search behaviour !

    See you later…

    Cheers,

    guy038

    P.S. :

    Glossar, just see your reply to Vasile. Quite pleased that it works as expected, on your configuration !

    BTW, some of us may could test my regex ? May be, it will help us to identify the problem :-)

    One more point, Vasile, which N++ version are you using ?



  • hello. I am using v7.1, no update available.

    But, I had an error yesterday morning, something when N++ had to update Plugin Manager and a Npp plugin, don’t remember very well. I will restart the computer tomorow, and I will test again.



  • no, after restart nothing change. And I installed the v.722, ant still doesn’t work. What a bug is this?



  • @guy038 said:

    Click THREE times, on the Replace All button, till the message Replace All: 0 occurrences were replaced is displayed, in blue, at the bottom of the Replace dialog

    Out of curiosity I tried it, and found that I had to press Replace All only TWO times to get a complete replacement on these three groupings of text. The first press of Replace All does the first and third sets of data; the second press does the second set. However, in the end, it changed the data as expected.



  • Hi, Scott, glossar and vasile,

    Yes, Scott, two times are enough, indeed !. However, I replied to glossar for the general case where you do not know, exactly, what is the maximum of lines with “identical beginnings”, because of a huge file, for instance !

    In that case, it’s better to click on the Replace All button till the message 0 occurrences were replaced appears ! Indeed, as long as yon obtain the message Nocccurrences were replaced, with N > 0, you cannot guess that no more occurrence has to be replaced, the next time :-))

    Cheers,

    guy038



  • @Scott-Sumner

    I press 50 times “Replace all”, and nothing happen. There is a bug somewhere…



  • @Frank-Orellana

    this is working fine !



  • hello guy38, and all friends. Maybe you can improve my regex to resolve the solution (other way).

    So, the regex below will bind (merge) all the sentences into one. The problem is that is not cut the words that repeats.

    Search:
    \s+(.*?)

    Replace with:
    leave space



  • there will be another good solution, that works:

    Find What: ^(\w+\s+\w+\s*)(.*)\n\1
    Replace With: \1\2,



  • @guy038 How can I combine a specific line with a character, ei. Line 2 - 7 should be in line 2 only. and same with the others

    e1b28aa3-eac0-459b-b0aa-ca391816e22e-image.png


Log in to reply