On 2022-12-28 18:42, Alexander Richert - NOAA Affiliate via Python-list wrote:
  In a couple recent versions of Python (including 3.8 and 3.10), the
following code:
import re
print(re.sub(".*", "replacement", "pattern"))
yields the output "replacementreplacement".

This behavior does not occur in 3.6.

Which behavior is the desired one? Perhaps relatedly, I noticed that even
in 3.6, the code
print(re.findall(".*","pattern"))
yields ['pattern',''] which is not what I was expecting.

It's not a bug, it's a change in behaviour to bring it more into line with other regex implementations in other languages.
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to