You are here: Regex to get the <html></html> « PHP Programming Language « IT news, forums, messages
Regex to get the <html></html>

Posted by FFMG on 08/02/07 15:48

Hi,

I want to get the <head> code and a 'simple?' solution seems to be
be...

preg_match_all("/<[html]+[^>]*>\s*(.*\s*)<\/html>\s*/i", $html,
$matches, PREG_SET_ORDER);

but I want to make sure that there isn't a better solution to the
problem especially if the head contains invalid code like...

//--
<head>
<meta name="description" content="<head></head>" />
</head>
//--

unfortunately this is my html code so I cannot ignore invalid <head>
like the one above.

So...
How can I change my regex to ignore head tags inside double or single
quotes?
How can I look for multiple line code inside the head.

Any suggestions?

FFMG


--

'webmaster forum' (http://www.httppoint.com) | 'Free Blogs'
(http://www.journalhome.com/) | 'webmaster Directory'
(http://www.webhostshunter.com/)
'Recreation Vehicle insurance'
(http://www.insurance-owl.com/other/car_rec.php) | 'Free URL
redirection service' (http://urlkick.com/)
------------------------------------------------------------------------
FFMG's Profile: http://www.httppoint.com/member.php?userid=580
View this thread: http://www.httppoint.com/showthread.php?t=19012

Message Posted via the webmaster forum http://www.httppoint.com, (Ad revenue sharing).

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация