Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: \s matches newline in regex?

by AnomalousMonk (Archbishop)
on Jul 22, 2015 at 23:31 UTC ( [id://1135921]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1135921]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-04-19 14:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found