RE: [PHP] ereg() violence
| From: | Maxim Maletsky | Date: | Wed, 08 Nov 2000 04:19:15 +0000 |
| Subject: | RE: [PHP] ereg() violence | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-24258@lists.php.net to get a copy of this message | ||
You can use HTML_ENTITIES,
$trans = get_html_translation_table(HTML_ENTITIES);
$trans[" "] = " ";
$html = strtr($original, $trans);
this will transform every HTML-looking tag into the format that you can see
on a vebsite,
then you adding and adding
ereg()
# after
ereg()
can fix other issues..
Cheers
-----Original Message-----
From: Jesse Binam [mailto:sirbinam@xmission.com]
Sent: Wednesday, November 08, 2000 1:10 PM
To: php-general@lists.php.net
Subject: [PHP] ereg() violence
I have been screwing with this thing for 7 hours and CANNOT get it to work.
When the author submits an html message the script needs to:
replace tags like <br>, <p>, <div> with \n
replace HTML codes with text equivelent like & with &
strip all other HTML tags that have no place in a text message like <b>,
<font>, etc.
and it would be nice if it would find the img tags and replace them with
something like <<http://www.isp.com/images/pic.jpg>>
But I am running into some serious problems!!
Either I can't get the regular expression right or it times out (possibly
because the regular expression is wrong)
I just don't know what to do. I think it would increase performance IF I
could somehow code it to replace only
what is there instead of searching for a every possible code whether it is
there or not.
Suggestions on this would be GREATLY appreciated
Jess
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net