This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author alegrigoriev
Recipients alegrigoriev, mrabarnett
Date 2021-04-04.02:35:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1617503759.56.0.31102824184.issue43714@roundup.psfhosted.org>
In-reply-to
Content
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

Copyright 1987-2020, Larry Wall
$ perl -e 'my $x="a-b-"; $x =~ s/-?$/x/g; print $x'
a-bxx

https://www.freeformatter.com/java-regex-tester.html

Java Regular Expression :
-?$
Entry to test against :
a-b-c-
String replacement result:
a-b-cx

During replacement or split, a match consumes the matched character. It's easy to forget that "end of line" should be considered a (pseudo)character and must also be consumed if it matched.
History
Date User Action Args
2021-04-04 02:35:59alegrigorievsetrecipients: + alegrigoriev, mrabarnett
2021-04-04 02:35:59alegrigorievsetmessageid: <1617503759.56.0.31102824184.issue43714@roundup.psfhosted.org>
2021-04-04 02:35:59alegrigorievlinkissue43714 messages
2021-04-04 02:35:59alegrigorievcreate