3 ms·
This is a fair criticism, though it has been addressed some time in the last twelve years or so >>> import re; re.compile('').search('foo') <_sre.SRE_M
by formerly_proven 5y ago
This is a fair criticism, though it has been addressed some time in the last twelve years or so
>>> import re; re.compile('').search('foo')
<_sre.SRE_Match object; span=(0, 0), match=''>
- faho 5y agohttps://bugs.python.org/issue17087 https://bugs.python.org/issue17087, fixed in python 3.4 (released in March 2014). The article, from 2010, tested python 2.5.
- draw_down 5y agoOh nice. Upgrading from Python 2 to 3 is only one major version, should be no sweat!
- asicsp 5y agoIt is `re.Match object` now, which I think is more readable. Also, matched portions can be retrieved using `[N]` in addition to `.group(N)`