-
-
Save slow-is-fast/166cb7065b852acba1a643478693ad79 to your computer and use it in GitHub Desktop.
How to remove emoji from text.
Source: http://stackoverflow.com/questions/12807176/php-writing-a-simple-removeemoji-function Tested. Works.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment