Chris Devers wrote:
>
> At 10:45 AM 2001.07.02 +0100, Kristofer Wolff wrote:
> >hi folks i do a simple thing: parsing out the site title of an html...
> >
> > $subject =~ s/^(.*)\<title\>(.*)\<\/title\>(.*)$/$2/i;
> >
> >but he returns the complete HTML file, why ?
>
> I don't know, but I also don't know why you're trying to match everything. You don't
>seem to be interested in text outside the title tags, so skip it. A somewhat better
>match would be:
>
> $subject =~ s/\<title\>(.*)\<\/title\>/$2/sig;
$2 won't have anything in it. Try $1. And you shouldn't have to escape
the [<>]s.
This worked for me:
if ($html =~ m#<title>([^<]*)</title>#si) {
$title = $1;
}
else {
$title = '<none>';
}
--
-Tim Hammerquist <[EMAIL PROTECTED]>
M-x induce-carpal-tunnel-syndrome
-- Greg Bacon
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web