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 TheBrandonGuy
Recipients TheBrandonGuy, ezio.melotti, mrabarnett
Date 2020-04-19.20:01:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1587326483.24.0.84255521064.issue40332@roundup.psfhosted.org>
In-reply-to
Content
The regular expression used for matching numbers in the documentation for the regular expressions module (the tokenizer section) doesn't match the string ".5", but does match the string "3.".

Here's a link to the tokenizer section of the documentation: https://docs.python.org/3/library/re.html#writing-a-tokenizer

The tokenizer example uses r'\d+(\.\d*)?' for matching numbers. I would personally match ".5" as a number before I would match "3." as a number. In order to do this, I would use r'(\d*\.)?\d+' instead of r'\d+(\.\d*)?'. Python 3's interpreter matches both "3." and ".5" as numbers when interpreting code, so you could use a different regex example for matching both if you wanted to be consistent with Python's own interpreter.
History
Date User Action Args
2020-04-19 20:01:23TheBrandonGuysetrecipients: + TheBrandonGuy, ezio.melotti, mrabarnett
2020-04-19 20:01:23TheBrandonGuysetmessageid: <1587326483.24.0.84255521064.issue40332@roundup.psfhosted.org>
2020-04-19 20:01:23TheBrandonGuylinkissue40332 messages
2020-04-19 20:01:23TheBrandonGuycreate