I believe it is better to use strpos() in this case because it's faster.
?php
$start = strpos(strtolower($website_code), 'body');
// not necessary
$end = strpos(strtolower($website_code), '/body');
$code = substr($website_code, $start, $end-$start);
echo strip_tags($code); // clean text
?
I am trying to write a regex function to extract the readable
(visible, screen-rendered) portion of any web page. Specifically, I
only want the text between the body tags, excluding any script or
style tags within the document, also excluding comments. Has anyone
here seen such a regex? Is
- Original Message -
From: M5 [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Tuesday, February 27, 2007 6:47 PM
Subject: [PHP] Extract printable text from web page using preg_match
I am trying to write a regex function to extract the readable
(visible, screen-rendered) portion
On Tue, February 27, 2007 11:47 am, M5 wrote:
I am trying to write a regex function to extract the readable
(visible, screen-rendered) portion of any web page. Specifically, I
only want the text between the body tags, excluding any script or
style tags within the document, also excluding
On 27-Feb-07, at 1:44 PM, Richard Lynch wrote:
On Tue, February 27, 2007 11:47 am, M5 wrote:
I am trying to write a regex function to extract the readable
(visible, screen-rendered) portion of any web page. Specifically, I
only want the text between the body tags, excluding any script or
5 matches
Mail list logo