NYCPHP Meetup

NYPHP.org

[nycphp-talk] strange regex problem

FB` fb at intldef.org
Mon Aug 11 18:57:24 EDT 2003


Thanks!

That works nicely.

Any thoughts on what would make previous regex so nasty?

FB`

----- Original Message ----- 
From: "David Sklar" <sklar at sklar.com>
To: "NYPHP Talk" <talk at lists.nyphp.org>
Sent: Monday, August 11, 2003 6:34 PM
Subject: RE: [nycphp-talk] strange regex problem


> 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
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk



More information about the talk mailing list