> 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...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to