coldfingertips has asked for the wisdom of the Perl Monks concerning the following question:

I need to match
Showing Results <b>1 thru 4</b> of 4
Which is taken from $lycos_content ($content is the source code dump of the page as taken from LWP::UserAgent).

The numbers will always be different. It could be 1 thru 7 of 7. But the results, if large, may have some number separators I have to watch out for, too.

From my count, there are 7 tabs after the URL and one space after that before the "1 of" begins. I need to match the total number in $1.

This is my attempt but sadly it fails

$lycos_content =~ |Showing Results <b>\d thru \d</b> of\s*\t* (\d[\d,] +*)|s; my $lycos_results = $1; if (!defined $lycos_results) { $lycos_results=0; }
If you want to see first hand what the results look like, try going to http://search.lycos.com/default.asp?loc=searchbox&query=linkdomain%3Awww.test.comv .

Thank you.

Replies are listed 'Best First'.
Re: regex to match Lycos results
by BrowserUk (Patriarch) on Jan 28, 2005 at 02:23 UTC

    Try

    m[Showing Results <b>\d+ thru \d+</b> of\s+([\d,]+)\s+\(]s;

    Examine what is said, not who speaks.
    Silence betokens consent.
    Love the truth but pardon error.
      Thank you BrowserUk, that did it perfectly.