python regular expression help

Qilong Ren qilong_ren at yahoo.com
Wed Apr 11 21:10:07 EDT 2007


Hi, everyone,

I am extracting some information from a given string using python RE. The string is ,for example,
   s = 'a = 4 b =3.4 5.4 c = 4.5'
What I want is :
   a = 4
    b = 3.4 5.4 
   c = 4.5
Right now I use : 
   pattern = re.compile(r'\w+\s*=\s*.*?\s+')
   lists = pattern.findall(s)
It works for the string like 'a = 4 b = 3.4 c = 4.5', but does not work with strings like 'a=4 b=3.4 5.4 c = 4.5'

Any suggestion?

Thanks,Qilong




       
____________________________________________________________________________________
It's here! Your new message!  
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070411/a4d6a81b/attachment.html>


More information about the Python-list mailing list