Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.