Re: Extract HTML tags

From: Date: Thu, 10 Oct 2002 03:06:42 +0000
Subject: Re: Extract HTML tags
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-119491@lists.php.net to get a copy of this message
try something along the lines of: preg_match('/<body[^>]*>([.]*)</body>/im', $string, $foo); $foo[1] = 'your body string'; preg_match('/<head>([.]*)<body/im', $string, $bar); $bar[1] = 'your head string'; while not tested (and probably off a little) this should get you going... -js Shawn McKenzie wrote:
I've loaded an html file into a string. What I'd like to do is create two new strings: first new string with the original string but remove all content from the beginning of the file up to and including <body>, and then remove from the end of file up to and including </body> second new string only containing content after <head> up to and including <body> Any ideas on simple ways to do this? TIA -Shawn


« previous php.general (#119491) next »