Skip to content

Instantly share code, notes, and snippets.

@quantizer
Created June 9, 2013 19:42
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save quantizer/5744907 to your computer and use it in GitHub Desktop.
Save quantizer/5744907 to your computer and use it in GitHub Desktop.
function removeEmoji($text)
{
$cleanText = "";
// Match Emoticons
$regexEmoticons = '/[\x{1F600}-\x{1F64F}]/u';
$cleanText = preg_replace($regexEmoticons, '', $text);
// Match Miscellaneous Symbols and Pictographs
$regexSymbols = '/[\x{1F300}-\x{1F5FF}]/u';
$cleanText = preg_replace($regexSymbols, '', $cleanText);
// Match Transport And Map Symbols
$regexTransport = '/[\x{1F680}-\x{1F6FF}]/u';
$cleanText = preg_replace($regexTransport, '', $cleanText);
return $cleanText;
}
@alihossein
Copy link

very very good. TNKs

@mgilberties
Copy link

Please excuse my lack of understanding around how emoji Unicode works.
This is nice and clean but doesn't work for the "hugging_face" emoji: https://emojipedia.org/hugging-face

@aankun
Copy link

aankun commented Jan 25, 2018

Also not working for "rolling-on-the-floor-laughing" one https://emojipedia.org/rolling-on-the-floor-laughing/

@parsibox
Copy link

not work

سلام تست شد 🥊dolor 🤒sit amet, consectetur adipiscing elit. 

@quantizer
Copy link
Author

Looks like it's time to update this code :)

@mamalheydar
Copy link

work very well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment