Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: newlines in regular expressions

by conrad (Beadle)
on Dec 07, 2004 at 10:29 UTC ( #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? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2023-03-30 01:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (73 votes). Check out past polls.

    Notices?