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

Re: regex across multiple lines

by frankus (Priest)
on Jun 28, 2002 at 09:08 UTC ( [id://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.

    Regards

    mndoci

    "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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2024-03-19 08:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found