Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: newlines in regular expressions

by conrad (Beadle)
on Dec 07, 2004 at 10:29 UTC ( [id://412878]=note: print w/replies, xml ) Need Help??


in reply to newlines in regular expressions

None of the non-<>-print solutions I see here will cope with a single opening blank line since they all search for multiple \n characters. This does the trick using the /m modifier, which allows ^ to match the beginning of a line anywhere in your string:

perl -p0777e 's/^\n+//mg'

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-24 21:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found