3
import re    
emoji_pattern = re.compile("["
            u"\U0001F600-\U0001F64F"  # emoticons
            u"\U0001F300-\U0001F5FF"  # symbols & pictographs
            u"\U0001F680-\U0001F6FF"  # transport & map symbols
            u"\U0001F1E0-\U0001F1FF"  # flags (iOS)
                               "]+", flags=re.UNICODE)
    print(emoji_pattern.sub(r'', text))

but still some emoji such:{ , ⭐️, , } appear after filtering , I need to remove all emojis symbol

kiyah
  • 1,502
  • 2
  • 18
  • 27
Noura
  • 151
  • 1
  • 3
  • 10
  • Check out the Git project [here](https://gist.github.com/jinstrive/34d1796bd2dd46b6aa52) it worked for me – iam.Carrot Feb 19 '18 at 06:52
  • 4
    Your problem may be harder to solve than it seems. There is no formal definition of an emoji, which makes writing a regex for emoji recognition next to impossible. Perhaps you should _extract_ the non-emojis rather than _remove_ the emoji. – DYZ Feb 19 '18 at 07:09
  • There's an [emoji package](https://pypi.python.org/pypi/emoji/) on pypi you could use. Then all you need is something like ```if char in emoji.UNICODE_EMOJI #remove the emoji``` – ConorSheehan1 Feb 19 '18 at 08:58
  • 1
    [So many duplicates](https://stackoverflow.com/search?q=%5Bpython%5D+is%3Aq+remove+emoji) - but all with varying ranges for "what is an emoji". Perhaps Unicode should stop adding them. But see https://stackoverflow.com/q/26568722/2564301 for an approach to this. – Jongware Feb 19 '18 at 10:09

0 Answers0