in reply to Re: Multiline replace regexp.
in thread Multiline replace regexp.

Are the effects of /s really wanted here?

update

I'm confused, depending on how I understand the OP it's either /s or /m , but not both.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^3: Multiline replace regexp.
by hippo (Archbishop) on May 21, 2018 at 13:27 UTC
    Are the effects of /s really wanted here?

    Yes, because without /s the newlines are not matched.

    Code added for clarity:
    #!/usr/bin/env perl use strict; use warnings; use Test::More tests => 2; my $q = 'qqqweqwe asdasdasd zxczxczxc tyutyutyi '; my $a = 'zxczxczxc'; my $want = "\ntyutyutyi\n"; my $t = $q; $t =~ s/^.*$a//sm; is ($t, $want, "With /s - matched"); $t = $q; $t =~ s/^.*$a//m; isnt ($t, $want, "No /s - not matched");
      If that's what the OP wants, then better omit /m

      Otherwise is ^ matching for every line start, not only the strings start.

      It's at best redundant.

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Wikisyntax for the Monastery