Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: match across specified # of lines

by hbm (Hermit)
on Jun 13, 2013 at 14:43 UTC ( #1038755=note: print w/ replies, xml ) Need Help??


in reply to match across specified # of lines

Make your dot-stars non-greedy, and use the 'm' modifier:

$_=" Blah junk .PP blah more stuff .PP boo razz "; print $1 if /^(\.PP.*?\n.*?\n\.PP)/m; #prints .PP blah more stuff .PP


Comment on Re: match across specified # of lines
Download Code
Re^2: match across specified # of lines
by bill b (Initiate) on Jun 13, 2013 at 14:50 UTC
    Thanks! That worked! I did have the m appended but forgot to type it. Your solution really helped a lot. Cheers!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (18)
As of 2014-07-23 10:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (140 votes), past polls