This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jmfauth
Recipients jmfauth
Date 2010-03-20.17:20:58
SpamBayes Score 0.00810522
Marked as misclassified No
Message-id <1269105660.91.0.785511899143.issue8185@psf.upfronthosting.co.za>
In-reply-to
Content
>>> sys.version
2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit
(Intel)]
>>> import re
>>> re.match("[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?", "1.23e-4").group()
1.23e-4
>>> re.search("[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?", "1.23e-4").group()
1.23e-4
>>> for e in re.finditer("[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?", "1.23e-4"):
        print e.group()
        
1.23e-4

but

>>> re.findall("[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?", "1.23e-4")
['e-4']
>>> 

It seems re.findall() does not like patterns containing parentheses.

>>> re.findall("[-+]?[0-9]+[.]?[0-9]*[eE][-+]?[0-9]+", "1.23e-4")
['1.23e-4']
>>> 
>>> re.findall("a(b)?", "ab")
['b']
>>> re.findall("ab?", "ab")
['ab']
>>>
History
Date User Action Args
2010-03-20 17:21:01jmfauthsetrecipients: + jmfauth
2010-03-20 17:21:00jmfauthsetmessageid: <1269105660.91.0.785511899143.issue8185@psf.upfronthosting.co.za>
2010-03-20 17:20:59jmfauthlinkissue8185 messages
2010-03-20 17:20:59jmfauthcreate