Jump to content

htmlentites remove


The Little Guy

Recommended Posts

perhaps you can throw html_entity_decode into the mix?

 

I think he wants to completely remove them not decode them.

 

I want to completely remove them.

 

well I was thinking more along the lines of decoding, then using something else to remove the decoded stuff, hence the whole "throw it into the mix" thing.

Link to comment
https://forums.phpfreaks.com/topic/138740-htmlentites-remove/#findComment-725414
Share on other sites

as I am have been thinking, I think I would like to keep some of the entities. I would like to remove all of the entities that would be useless if you were to do a search, on the database, such as: quot, copy, apos, etc.

 

I would like to keep amp and any other commonly searched for decoded entities.

Link to comment
https://forums.phpfreaks.com/topic/138740-htmlentites-remove/#findComment-725422
Share on other sites

as I am have been thinking, I think I would like to keep some of the entities. I would like to remove all of the entities that would be useless if you were to do a search, on the database, such as: quot, copy, apos, etc.

 

I would like to keep amp and any other commonly searched for decoded entities.

 

If the purpose of this is for a search, why can't you just decode the entities when you're comparing against the database?

Link to comment
https://forums.phpfreaks.com/topic/138740-htmlentites-remove/#findComment-725456
Share on other sites

I think the "Keep" list would be shorter, So...

 

not sure how I would do that...

 

well, for instance, you can do something like this:

 

$keepers = array('(amp)','(bar)');
$string = "&foo; something blah & blah &bar; something &blah;";
$keep = implode ("|",$keepers);
$string = preg_replace("~&(?!".$keep.")[^;]*;~","",$string);

 

Link to comment
https://forums.phpfreaks.com/topic/138740-htmlentites-remove/#findComment-725460
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.