RegEx Newbie
Posted: 24.03.2022, 15:18
I'm a total RegEx newbie and need some help!
I have a directory with hundreds of file names in this format:
Prefix-CityName-St-Country-Date
The problem I have is that CityName can be 1, 2, or 3 words, separated by dashes. I need it to be changed to one word. There are about 70 multiple word city names.
Examples:
Prefix-City-Name-St-Country-Date needs to be changed to Prefix-CityName-St-Country-Date
Prefix-3Word-City-Name-St-Country-Date must be changed to Prefix-3WordCityName-St-Country-Date
I tried to do this but was unable to: I know nothing about RegEx!
Anyone able to help?
Thanks very much,
John
I have a directory with hundreds of file names in this format:
Prefix-CityName-St-Country-Date
The problem I have is that CityName can be 1, 2, or 3 words, separated by dashes. I need it to be changed to one word. There are about 70 multiple word city names.
Examples:
Prefix-City-Name-St-Country-Date needs to be changed to Prefix-CityName-St-Country-Date
Prefix-3Word-City-Name-St-Country-Date must be changed to Prefix-3WordCityName-St-Country-Date
I tried to do this but was unable to: I know nothing about RegEx!
Anyone able to help?
Thanks very much,
John