For example i have
06183,19760201,19891231,16,54.9101,8.3268,Westerland, (Wind),Schleswig-Holstein
06184,19880801,20090615,6,53.5333,8.1667,Wilhelmshaven, (Flugplatz),Niedersachsen
06186,20000401,20190527,268,50.1989,7.8651,Nastätten,Rheinland-Pfalz
I search with ^(?:.+?,){8}
to find lines with 8 ,
When i do this in Notepad++ it select the line all the way to the 8th ,
.
How can i remove this last comma because if i replace now with whitespace the whole selection is replaced.
The result should look like:
06183,19760201,19891231,16,54.9101,8.3268,Westerland (Wind),Schleswig-Holstein
06184,19880801,20090615,6,53.5333,8.1667,Wilhelmshaven (Flugplatz),Niedersachsen
06186,20000401,20190527,268,50.1989,7.8651,Nastätten,Rheinland-Pfalz
That there is only 1 comma between place and state.
The solution is to capture all the text before the 7th comma in a group (so only include 6 commas there), match the 7th comma outside that group, and require there is an 8th ahead. Then reproduce that group as replacement:
Find what: ^((?:.+,){6}.+),(?=.+,)
Replace with: \1
⦿ Regular expression ☐ . matches newline
Replace All