1.1 --- a/EventAggregatorSupport.py Wed May 11 00:45:47 2011 +0200
1.2 +++ b/EventAggregatorSupport.py Fri May 13 01:36:26 2011 +0200
1.3 @@ -50,7 +50,12 @@
1.4 # Value parsing.
1.5
1.6 country_code_regexp = re.compile(ur'(?:^|\W)(?P<code>[A-Z]{2})(?:$|\W+$)', re.UNICODE)
1.7 -location_normalised_regexp = re.compile(ur"([\w-]+(?:,(?:\s*[\w-]+)+)?)$", re.UNICODE)
1.8 +location_normalised_regexp = re.compile(
1.9 + ur"(?:\d+\w*\s+)?" # preceding postcode (optional)
1.10 + ur"(?P<location>" # start of group of interest
1.11 + ur"\w[\w\s-]+?" # area or town
1.12 + ur"(?:,(?:\s*[\w-]+)+)?" # country (optional)
1.13 + ur")$", re.UNICODE)
1.14
1.15 month_regexp_str = ur'(?P<year>[0-9]{4})-(?P<month>[0-9]{2})'
1.16 date_regexp_str = ur'(?P<year>[0-9]{4})-(?P<month>[0-9]{2})-(?P<day>[0-9]{2})'
1.17 @@ -334,7 +339,7 @@
1.18
1.19 match = location_normalised_regexp.search(location)
1.20 if match:
1.21 - return match.group()
1.22 + return match.group("location")
1.23 else:
1.24 return None
1.25