Hi every
following ruby snippet
#!/bin/ruby
abc = " Erste Zeile
Zweite Zeile
Dritte Zeile
Vierte Zeile
"
puts abc
abc.sub!(/le.?$/s, “le Ende” )
puts abc
produces following output:
[[email protected] ~/work/rad/cgi]$ ruby regex.rbx
Erste Zeile
Zweite Zeile
Dritte Zeile
Vierte Zeile
Erste Zeile Ende
Zweite Zeile
Dritte Zeile
Vierte Zeile
[[email protected] ~/work/rad/cgi]$
whereas following perl snippet which is functionally equal to the ruby
snippet
#!/bin/perl
$abc = " Erste Zeile
Zweite Zeile
Dritte Zeile
Vierte Zeile
";
print $abc;
$abc =~ s/le.?$/le Ende\n/s;
print $abc;
produces following output
[[email protected] ~/work/rad/cgi]$ perl perly.pl
Erste Zeile
Zweite Zeile
Dritte Zeile
Vierte Zeile
Erste Zeile
Zweite Zeile
Dritte Zeile
Vierte Zeile Ende
[[email protected] ~/work/rad/cgi]$
Seems that the two disagree in the significance of the s modifier of the
Regular Expression.
Is this a bug on either side?
suomi