Message366801
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. |
|
Date |
User |
Action |
Args |
2020-04-19 20:01:23 | TheBrandonGuy | set | recipients:
+ TheBrandonGuy, ezio.melotti, mrabarnett |
2020-04-19 20:01:23 | TheBrandonGuy | set | messageid: <1587326483.24.0.84255521064.issue40332@roundup.psfhosted.org> |
2020-04-19 20:01:23 | TheBrandonGuy | link | issue40332 messages |
2020-04-19 20:01:23 | TheBrandonGuy | create | |
|