[issue1761] Bug in re.sub()
Amaury Forgeot d'Arc
report at bugs.python.org
Tue Jan 8 22:47:04 CET 2008
Amaury Forgeot d'Arc added the comment:
In the previous samples we forgot the /g option needed to match ALL
occurrences of the pattern:
"""
use Data::Dumper;
$a = "a\nb\nc";
$a =~ s/$/#/g;
print Dumper($a);
$a = "a\nb\n";
$a =~ s/$/#/g;
print Dumper($a);
"""
Which now gives the same output as Python:
$VAR1 = 'a
b
c#';
$VAR1 = 'a
b#
#';
Perl is too difficult for us ;-)
What shall we do?
- mark the issue as invalid
- diverge from Perl regular expressions
- file a bug in the PCRE issue tracker
And in every case: add these samples to the test suite.
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1761>
__________________________________
More information about the Python-bugs-list
mailing list