in reply to Re: \s matches newline in regex?
in thread \s matches newline in regex?

If there were repeated, contiguous newlines, that would only avoid replacing the final newline.

c:\@Work\Perl\monks>perl -wMstrict -le "my $line = qq{HeHi\n\n\nHo}; print qq{[$line]}; ;; $line =~ s/Hi\s*(?=\n)//; print qq{[$line]}; " [HeHi Ho] [He Ho]


Give a man a fish:  <%-(-(-(-<

Replies are listed 'Best First'.
Re^3: \s matches newline in regex?
by stevieb (Canon) on Jul 22, 2015 at 23:38 UTC

    Yes, I'm aware of that, but it would have been prudent for me to have pointed that out.

    Thanks AnomalousMonk.

    -stevieb