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.

classification
Title: 4.2.6 (re) Examples: float regexp exponential on failure
Type: Stage:
Components: Documentation Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: akuchling Nosy List: akuchling, lupan, nnorwitz
Priority: normal Keywords:

Created on 2003-11-24 20:01 by lupan, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test-float-re.py lupan, 2003-11-24 20:01 demo of exponential effect
Messages (3)
msg19104 - (view) Author: Lukasz Pankowski (lupan) Date: 2003-11-24 20:01
When using given regexp for floats

[-+]?(\d+(\.\d*)?|\d*\.\d+)([eE][-+]?\d+)?

'0.5' will match both alternatives on failure, which
makes exponential number of matches on failure if
matching multiple float numbers  '0.5 0.5 0.5' using
one regexp which fail at the end (attached test script).

If replaced with slightly less verbose (without '\d*'
after '|'):

[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?

'0.5' fails on the second branch and the exponential
effect does not occur.
msg19105 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2005-10-02 06:43
Logged In: YES 
user_id=33168

Gustavo, are you still interested in re issues?  This is
actually a doc issue (I think it's only a doc issue).  Any
comments?  I can make a change if you want me to, just let
me know what to do.
msg19106 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2006-07-31 16:22
Logged In: YES 
user_id=11375

The suggested change seems reasonable, so I've applied it. 
Thanks!
History
Date User Action Args
2022-04-11 14:56:01adminsetgithub: 39592
2003-11-24 20:01:40lupancreate