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

Re: regex on previous lines

by sundialsvc4 (Monsignor)
on Jan 31, 2013 at 22:45 UTC ( #1016410=note: print w/ replies, xml ) Need Help??


in reply to regex on previous lines

This is, or could be, quite easy.   First, read (or otherwise get ...) all three strings.   (Die horribly if you can’t...)   Simply put them into three variables ... let’s call ’em $x, $y, $z.

I said it would be easy....

if ($y ~= /regex2/) { if ($y =~ /regex1/) { ... feel free ... } }

Perhaps you would instead decide to keep the three strings in an array.   In that case, $x would be $array[0] and so-on.   If you want to maintain a three-string “window” on a file, functions such as length(), push, shift will come in handy.

If you will please give us more details about exactly what you’re up to, The Monks will be pleased to help you more.   “Ask a more-precise question, get a more-precise answer, and, hey, both of us can call it a day and go to the pub.”


Comment on Re: regex on previous lines
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2014-07-30 00:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (229 votes), past polls