Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: Regexp help, multiple lines

by CombatSquirrel (Hermit)
on Aug 16, 2004 at 05:34 UTC ( [id://383200]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Regexp help, multiple lines
in thread Regexp help, multiple lines

You might want to use something like this
#!perl use strict; use warnings; my $paragraph = 0; for (<DATA>) { do { ++$paragraph; next; last if $paragraph > 2 } if substr($_, 5, 1) ne ' '; print if $paragraph == 2; } __DATA__ Paragraph1: text Paragraph2: text1 text2 text3 Paragraph3: text
Hope this helped.
CombatSquirrel.

Entropy is the tendency of everything going to hell.

Replies are listed 'Best First'.
Re^4: Regexp help, multiple lines
by 2ge (Scribe) on Aug 16, 2004 at 08:16 UTC
    here is solution, which help me, combining all of your answers, I know name of start Paragraph, but don't know name of end Paragraph, so...THANKS (sorry for mess in replies):

    #!perl use strict; use warnings; my $para = 'Paragraph2:'; while (<DATA>) { print if (/^ {5}$para:?\s*$/i ... /^ {5}\S/ and /^ {7}/) } __DATA__ Paragraph1: text11 Paragraph2: text21 text22 text23 Paragraph3: text31

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (None)
    As of 2024-04-25 01:41 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found