Thank you for the replies and Happy New Year!
On Thu, Dec 31, 2009 at 7:19 PM, Dave Angel wrote:
> Norman Khine wrote:
>>
>> hello,
>>
>>
>
> import re
> line = "ALSACE 67000 Strasbourg 24 rue de la Division Leclerc 03 88 23
> 05 66 strasbo...@artisansdumonde.org"
> m = re.sea
Norman Khine wrote:
hello,
import re
line = "ALSACE 67000 Strasbourg 24 rue de la Division Leclerc 03 88 23 05 66
strasbo...@artisansdumonde.org"
m = re.search('[\w\-][\w\-\...@[\w\-][\w\-\.]+[a-za-z]{1,4}', line)
emailAddress .search(r"(\d+)", line)
phoneNumber = re.compile(r'(\d{2}) (\d{2
What's wrong with the phone number?
>>> phoneNumber.search(line).groups()
('03', '88', '23', '05', '66')
This looks fine to me.
Here is a regex that splits the line into several named groups. Test it with
other strings, though
>>> line = "ALSACE 67000 Strasbourg 24 rue de la Division Leclerc 03
hello,
>>> import re
>>> line = "ALSACE 67000 Strasbourg 24 rue de la Division Leclerc 03 88 23 05
>>> 66 strasbo...@artisansdumonde.org"
>>> m = re.search('[\w\-][\w\-\...@[\w\-][\w\-\.]+[a-za-z]{1,4}', line)
>>> emailAddress .search(r"(\d+)", line)
>>> phoneNumber = re.compile(r'(\d{2}) (\d{2})