Regular Expressions

Ed Suominen ed-no at spam-eepatents.com
Sat Mar 27 18:14:15 EST 2004


Sorry, the RE should be '(\d+)\s+\"([\w\']+)[,\s]+([\w\']+)'

Ed Suominen wrote:

> m = sre.search('(\d+)\s+\"[\w\'][,\s]+([\w\'])', s)
> x = (int(m.group(1)), group(2), group(3))
> 
> - Ed Suominen
> 
> achaljalan at yahoo.com wrote:
> 
>> Hey,
>> 
>> I have a string
>> 
>>         s =740446505        "O'HANLON, Benjamin"
>> 
>> i need to use one RE to convert it into
>>   
>>        (740446505, "O'HANLN", "Benjamin"),
>> 
>> I am using python 2.3 and have been stuydin the various tutotrials and
>> the howto websites for the past 3 days and haven't managed to find a
>> solution.
>> 
>> Any help to get to the solution will be very very helpful.
>> 
>> Thanks in advance for all the help.
>> 
>> Achal Jalan
>> 
>> 
>> ---------------------------------
>> Do you Yahoo!?
>> Yahoo! Finance Tax Center - File online. File on time.




More information about the Python-list mailing list