in reply to Matching Across Lines

Ok, wait
I re-read the archs again. I changed my regexp to

if ($text =~ /[^Total Datafile Size MB\s*\n(.*)^-{22}]/s)
Seems to be working (I think)

Now all I need is to match for the number on the 3rd
line and grab it.

mohammed

Replies are listed 'Best First'.
Re: Re: Matching Across Lines
by matija (Priest) on Feb 24, 2004 at 21:48 UTC
    To do that, the regexp should be
    if ($text =~ /^Total Datafile Size MB\s*\n(.*)^-{22}\s*\n(\d+\.\d+)/s)
    The second number will now be in $2.

    While you're at it, you should also change the .* in the first paren with something like \d+\.\d+.

    I realize both work right now, but if you get some funny stuff in your file, the stricter version will make sure you don't pick up a non-number.