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


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?
> -Shawn

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to