[PHP] strip from html to closing body tag

2002-01-07 Thread WB

Hi,
Hi i need to strip out the html up  to the body tag.
For some reason, my function,
 preg_replace( /html(.*)body(.*) ,   , $body );
does not work.
Ok I am not really brilliant at regular expressions ...

Help?

Jay


Re: [PHP] strip from html to closing body tag

2002-01-07 Thread S. Murali Krishna


Hi,
Ur quest is not clear.
Whether u want to delete everything upto body tag or only html tags
up to body tag.

anyway this might work for the former.

$parsed = preg_replace(/\\n/,,$html); // to remove  '\n' in HTML file
$parsed = preg_replace(/^(html.*)(body.*)/,\\2,$parsed);  // to
remove string upto body tag


Thanks.


On Mon, 7 Jan 2002, WB wrote:

 Hi,
 Hi i need to strip out the html up  to the body tag.
 For some reason, my function,
  preg_replace( /html(.*)body(.*) ,   , $body );
 does not work.
 Ok I am not really brilliant at regular expressions ...
 
 Help?
 
 Jay

S.Murali Krishna
[EMAIL PROTECTED]  
= 
We grow slow trying to be great

   - E. Stanley Jones
-


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] strip from html to closing body tag

2002-01-07 Thread Jimmy

Hi WB,


 Hi i need to strip out the html up  to the body tag.
 preg_replace( /html(.*)body(.*) ,   , $body );

try this:
preg_replace( /html[^body]*body[^]*/ ,   , $body );


--
Jimmy

Your mind is like parachute. It works best when it is open.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] strip from html to closing body tag

2002-01-07 Thread S. Murali Krishna


Hi,
the code u sent is displaying the html as it is,
but
There is more than one way to do that.

Atmost we can atleast do this.

  $pos = strpos($html,body);
$start = substr($html,0,$pos - 1);
$html  = substr($html,$pos);
$start = preg_replace(/html/,,$start);

print $start $html ;








On Mon, 7 Jan 2002, Jimmy wrote:

 Hi WB,
 
 
  Hi i need to strip out the html up  to the body tag.
  preg_replace( /html(.*)body(.*) ,   , $body );
 
 try this:
 preg_replace( /html[^body]*body[^]*/ ,   , $body );
 
 
 --
 Jimmy
 
 Your mind is like parachute. It works best when it is open.
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 

S.Murali Krishna
[EMAIL PROTECTED]  
= 
We grow slow trying to be great

   - E. Stanley Jones
-



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]