Dr.Ruud wrote:
Gunnar Hjalmarsson schreef:
[EMAIL PROTECTED]:
I have data in a text file where the important thing I want to extract is between two blank lines.

Assuming the data has been slurped into $_ :

     print "$1\n" while /\n\n(.+)(?=\n\n)/g;

Or /\n[[:blank:]]*\n(.+)\n[[:blank:]]*\n/ if "blank" includes blanks. :)

Right. However, the zero-width assertion (?=pattern) is important for the case of two consecutive "important things".

text
text

important line

other important line

text
text

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to