Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: \s matches newline in regex?

by kroach (Pilgrim)
on Jul 22, 2015 at 17:41 UTC ( #1135886=note: print w/replies, xml ) Need Help??


in reply to \s matches newline in regex?

You can use non-greedy matching and $ to match whitespace up until a newline.
$line =~ s/Hi\s*?$//m;

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2020-10-31 05:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (286 votes). Check out past polls.

    Notices?