문제

I have some string that looks like:

string1 string2 number1 number2 string3

and need to change it to: string1 string2,number1,number2 (without string3)

or:

string1 number1 number2 string2 >> string1,number1,number2 (without string2)

I used (\D*\s|\-\D*)\s*(\d{2}.\d{3})\s*(\d{2}.\d{3})(\D) to find matching strings, and $1,$2,$3; to get the final form, but was unsuccessful.

In string:

 Aleksandrów Kujawski 52.880  18.700  Kujawsko-Pomorskie 
 Aleksandrów Łódzki 51.820  19.299  Łódzkie 
 Andrychów 49.860  19.339  Małopolskie 
 Augustów 53.839  23.000  Podlaskie 

It changed it to:

 Aleksandrów Kujawski ,52.880,18.700; Kujawsko-Pomorskie 
 Aleksandrów Łódzki ,51.820,19.299; Łódzkie 
 Andrychów ,49.860,19.339; Małopolskie 
 Augustów ,53.839,23.000; Podlaskie 

What should looks like:

Aleksandrów Kujawski,52.880,18.700;
Aleksandrów Łódzki,51.820,19.299;
Andrychów,49.860,19.339;
Augustów,53.839,23.000;

Any hints?

도움이 되었습니까?

해결책

You could do in notepad++:

Fin what: ^(\s*\S+(?:\s+\D+)?)\s+(\S+)\s+(\S+).*
Replace with: $1,$2,$3;

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top