Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: regex across multiple lines

by frankus (Priest)
on Jun 28, 2002 at 09:08 UTC ( #177968=note: print w/replies, xml ) Need Help??

in reply to regex across multiple lines

$/=undef; $_=<DATA>; s/([^\n]*printf.*?printf.*?\n)[^\n]*\n/$1/gs; print; __DATA__ This line has a printf and is multiline This line has printf and is one line This line will not be printed

Based upon the test data provided, this works.
Are we to assume that the multiline is a multiline printf function?,
if so surely the line ends with a ';'?

More information please.


Brother Frankus.


Replies are listed 'Best First'.
Re: Re: regex across multiple lines
by mndoci (Scribe) on Jun 29, 2002 at 06:17 UTC

    You were quite right. That was the real problem and of course resolved in a similar way to what was suggested. I was curious about the possiblity of solving the problem if I had been provided a file with no ';'. It appears that the question in itself is unsound.



    "What you do in this world is a matter of no consequence. The question is, what can you make people believe that you have done?"-Sherlock Holmes in 'A study in scarlet'

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://177968]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2018-06-19 01:05 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (111 votes). Check out past polls.