[nycphp-talk] strange regex problem
David Sklar
sklar at sklar.com
Mon Aug 11 18:34:39 EDT 2003
If you just want the title out of the document, try this:
if (preg_match('@<title>(.*?)</title>@i',$str, $matches)) {
$title = $matches[1];
} else {
print "There's no title";
}
David
On Monday, August 11, 2003 5:58 PM, wrote:
> I have an apparently valid regular expression,
> ^.*<title>([^<]*)</title>.*$
> that works well in one site, but causes the server hosting a
> different site to grind its teeth to nubs on it - consistently
> exceeding max ex time...
>
> the full line goes like this:
> $text_a_title =
> eregi_replace("^.*<title>([^<]+)</title>.*$","\\1",$str);
>
> if i bypass this line, everything else works swimmingly...
>
>
> any suggestions?
> (taking a title from an html file)
>
>
> TIA
>
> FB`
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
More information about the talk
mailing list