On 2022-12-28 19:07:06 +, MRAB wrote:
> On 2022-12-28 18:42, Alexander Richert - NOAA Affiliate via Python-list
> wrote:
> > print(re.sub(".*", "replacement", "pattern"))
> > yields the output "replacementreplacement".
[...]
> It's not a bug, it's a change in behaviour to bring it more into lin
Please please fix you email client so that your replies stay with the
emails you are replying to.
Barry
On 28/12/2022 19:09, Stefan Ram wrote:
Alexander Richert writes:
|print(re.findall(".*","pattern"))
|yields ['pattern',''] which is not what I was expecting.
The asterisk is "greedy", so
On 12/28/22 11:07, MRAB wrote:
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".
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
Roel Schroeven schreef op 28/12/2022 om 19:59:
Alexander Richert - NOAA Affiliate via Python-list schreef op
28/12/2022 om 19:42:
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 "repla
Alexander Richert - NOAA Affiliate via Python-list schreef op 28/12/2022
om 19:42:
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 occu
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
i