Alexander Grigoriev added the comment:
For example, sed:
$ sed --version
sed (GNU sed) 4.8
Copyright (C) 2020 Free Software Foundation, Inc.
$ sed -e 's/-\?$/x/g' <<<'a-b-'
a-bx
Perl:
$ perl --version
This is perl 5, version 32, subversion 0 (v5.32.0) built for
x86_64-msys-thread-multi
Matthew Barnett added the comment:
Do any other regex implementations behave the way you want?
In my experience, there's no single "correct" way for a regex to behave;
different implementations might give slightly different results, so if the most
common ones behave a certain way, then
New submission from Alexander Grigoriev :
If '\Z' matches as part of a pattern in re.sub() or re.split(), it should
consume the end of string, and then '\Z' alone should not match the end of
string again.
Current behavior:
Python 3.9.2 (tags/v3.9.2:1a79785, Feb 19 2021, 13:44:55) [MSC