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

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.

    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
Node Status?
node history
Node Type: note [id://177968]
help
Chatterbox?
[choroba]: It should greatly simplify the parsing code, no flags or additional reading of the next buffer needed
[Corion]: choroba: Yeah, that's why I like that approach; it seems even quite obvious in retrospect to me, but many things are in hindsight ;)

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (9)
As of 2016-12-06 15:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (109 votes). Check out past polls.