Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Perl One Liner Regular Expressions

by hbm (Hermit)
on Aug 16, 2012 at 13:32 UTC ( #987765=note: print w/ replies, xml ) Need Help??


in reply to Re: Perl One Liner Regular Expressions
in thread Perl One Liner Regular Expressions

No need for parentheses; nor to escape the space; nor for the 'g' modifier - '.*' will gobble everything up, thus there can be only one match. So:

perl -p -i -e "s/^macros.*/macros regex/" monks.txt # or perl -p -i -e "s/^macros\K.*/ regex/" monks.txt


Comment on Re^2: Perl One Liner Regular Expressions
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2015-07-28 03:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (251 votes), past polls