You are here: Re: RegEx - replacing html entities « PHP Language « IT news, forums, messages
Re: RegEx - replacing html entities

Posted by Simon Harris on 02/10/07 14:57

Thanks for your reply - From what I have read, strip_tags has a limit of
1024 chars?

"Kimmo Laine" <spam@outolempi.net> wrote in message
news:eqkgtv$rlv$1@nyytiset.pp.htv.fi...
> Simon Harris wrote:
>> In this case, I want to remove them - I tried your suggestion, but it
>> still left &amp; in the string in my test (Using the function below).
>>
>> function html2txt($document){
>> $document = str_replace("<li>"," <li>",$document);
>> $search = array('@<script[^>]*?>.*?</script>@si', // Strip out javascript
>> '@<[\\/\\!]*?[^<>]*?>@si', // Strip out HTML tags
>> '#&\w+;#iU', // Strip out HTML entities such as
>> &nbsp;
>> '@<style[^>]*?>.*?</style>@siU', // Strip style tags
>> properly
>> '@<![\\s\\S]*?--[ \\t\\n\\r]*>@' // Strip multi-line
>> comments including CDATA
>> );
>> $text = preg_replace($search, '', $document);
>> return $text;
>> }
>>
>> Just out of curiosity, how would you decode them? Thinking about it, this
>> might actually work better for me.
>>
>
> Dude, strip_tags() is your friend. See php.net manual for details.
>
> --
> "En ole paha ihminen, mutta omenat ovat elinkeinoni." -Perttu Sirviφ
> spam@outolempi.net | Gedoon-S @ IRCnet | rot13(xvzzb@bhgbyrzcv.arg)

--------------------------------------------------------------------------------
I am using the free version of SPAMfighter for private users.
It has removed 3778 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация