Re: hopefully easy

From: Date: Wed, 29 Jan 2003 13:58:50 +0000
Subject: Re: hopefully easy
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-133486@lists.php.net to get a copy of this message
> I need to parse an HTML file for certain information. Like the text between > <title></title>. > > So if the html was ... > > <html> > <head> > <title>The page</title> > </head> > > <body> > > Lots of code ................. > > </body> > </html> > > I would just like the "The page" text. preg_match("!<title>(.*)</title>!si",$html,$match); echo $match[1]; That will account for <title> vs <TITLE> and also if <title> and </title> are on separate lines. You may have to add a U modifier if there is a chance </title> would be somewhere else in the text, although I don't know why it would be... ---John Holmes...

« previous php.general (#133486) next »