Link to home
Start Free TrialLog in
Avatar of James Froggatt
James FroggattFlag for France

asked on

Trimming out just the town/city names from a list using regular expressions

I have a long list of towns/cities, here's a sample:

1      Tórshavn      STR      13,335
2      Klaksvík      NOR      4,842
3      Hoyvík      STR      4,124
4      Argir      STR      2,188
5      Fuglafjørður      EYS      1,541
6      Vágur      SUD      1,342
7      Vestmanna      STR      1,236
8      Miðvágur      VAG      1,120
9      Sørvágur      VAG      1,108
10      Saltangará      EYS      1,012

I wish to efficiently create a list of just the towns/cities in Notepad++ so it looks as follows;

Tórshavn
Klaksvík
Hoyvík
Argir
Fuglafjørður
Vágur
Vestmanna
Miðvágur
Sørvágur
Saltangará

In Notepad++ what regular expression can I use to do this in the Replace "Find it" box.

Thank you
regexp.jpg
Avatar of Dimitris Maleas
Dimitris Maleas
Flag of Greece image

In notepad++ you can delete the columns very easy with the following procedure
Press and hold the SHIFT + ALT keys, and move down using the DOWN arrow on the keyboard (while still holding SHIFT + ALT).
Avatar of James Froggatt

ASKER

I can use that to remove the number and space up to the first character of the town name, but then there's no clear column to use after that to delete after the town/name i.e.


Wien      Wien      1,897,491
Graz      Stm      288,806
Linz      OÖ      205,726
Salzburg       Sbg      154,211
Innsbruck      Tir      132,110
Klagenfurt      Ktn      100,817
Villach      Ktn      62,243
Wels      OÖ      61,727
Sankt Pölten      NÖ      55,044

So I think I need a regular expression now, to the effect of;

"On each line select everything after the first space after the first word "

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Dimitris Maleas
Dimitris Maleas
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you all, this helped me sort this data out.