Extracting data, including some bracketed
Posted: Thu Oct 24, 2013 3:49 pm
My source looks like this (a list of long distance UK walks):
1066 Country Walk, East Sussex - 50 km (31 miles) Pevensey Castle to Rye
Abbeys Amble, North Yorkshire, 167 km (104 miles)
Abbott's Hike, 172 km (107 miles) Cumbria challenging moorland walking
Ainsty Bounds Walk, North Yorkshire, circular from Tadcaster, 71 km (44 miles)
Angles Way, 123 km (76 miles) from Great Yarmouth to Knettishall Heath, with much of the path following the Norfolk/Suffolk border. Additionally there is a link path from Knettishall Heath to Thetford
Avon Valley Path, 54 km (34 miles) Christchurch to Salisbury (Hampshire and Wiltshire)
Basingstoke Canal, 53 km (33 miles)
Bishop Bennet Way, 55 km (34 miles) Beeston to Wirswall (Cheshire, Staffordshire)
etc
I want a list like this:
1066 Country Walk, 31
Abbeys Amble, 104
Abbott's Hike, 107
Ainsty Bounds Walk, 44
etc
(So that I can import it into a spreadsheet and sort by distance.)
IOW I want the name before the first comma followed by a comma, a space and the mileage taken from inside the first pair of brackets.
I'm not clear why this doesn't work:
Find: (.*), (.*) \((.*) (.*)
Replace with: \1, \3
--
Terry, East Grinstead, UK
1066 Country Walk, East Sussex - 50 km (31 miles) Pevensey Castle to Rye
Abbeys Amble, North Yorkshire, 167 km (104 miles)
Abbott's Hike, 172 km (107 miles) Cumbria challenging moorland walking
Ainsty Bounds Walk, North Yorkshire, circular from Tadcaster, 71 km (44 miles)
Angles Way, 123 km (76 miles) from Great Yarmouth to Knettishall Heath, with much of the path following the Norfolk/Suffolk border. Additionally there is a link path from Knettishall Heath to Thetford
Avon Valley Path, 54 km (34 miles) Christchurch to Salisbury (Hampshire and Wiltshire)
Basingstoke Canal, 53 km (33 miles)
Bishop Bennet Way, 55 km (34 miles) Beeston to Wirswall (Cheshire, Staffordshire)
etc
I want a list like this:
1066 Country Walk, 31
Abbeys Amble, 104
Abbott's Hike, 107
Ainsty Bounds Walk, 44
etc
(So that I can import it into a spreadsheet and sort by distance.)
IOW I want the name before the first comma followed by a comma, a space and the mileage taken from inside the first pair of brackets.
I'm not clear why this doesn't work:
Find: (.*), (.*) \((.*) (.*)
Replace with: \1, \3
--
Terry, East Grinstead, UK