On Tue, Apr 19, 2005 at 03:32:22PM +0300, Offer Kaye wrote:
> On 4/19/05, lio lop wrote:
> > I need to print the text between two words
> >                               that are in different
> > lines.
> > 
> 

If you have:

This is a
nasty, multilined
chunk of
text

and you want to get everything between ',' and 'of' you would do

=~ m/,(.*?)of/s

which finds the first occurence of ',' takes every character (.) including 
newlines (s modifier at the end) until it sees the first 'of' (made 
non-greedy by ?) and will return everything in $1 (capturing set of ()s ).

Hope this helps


Peter

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


Reply via email to