1

Until now I was using the following code in order to detect emojis in text

emoji_regexp = u'[\U00002600-\U000026FF]|[\U00002700-\U000027BF]|[\U0001f300-\U0001f5fF]|[\U0001f600-\U0001f64F]|' \
               u'[\U0001f680-\U0001f6FF]'
re.findall(emoji_regexp, text, re.UNICODE)

But currently there are some cases where it doesn't detect new emojis (check out new emojis in this table), such as this emoji . I know that there were new emojis in the latest iOS update so maybe it's connected somehow.

I believe that I should modify 'emoji_regexp' but not quite sure what to add there.

Any suggestions?

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
Lior Magen
  • 1,533
  • 2
  • 15
  • 33
  • Possible duplicate of [Find out if Character in String is emoji?](http://stackoverflow.com/questions/30757193/find-out-if-character-in-string-is-emoji) – Horia Coman Nov 16 '16 at 09:41
  • Nope, firstly I'm asking about Python, secondly the suggested solution does not deal with new emojis. – Lior Magen Nov 16 '16 at 09:42
  • 2
    So, what is the problem? Just add those new symbols/sequences to your regex. Actually, it has nothing to do with NLP, it seems to be a pure regex issue. – Wiktor Stribiżew Nov 16 '16 at 09:45
  • 1
    This is basically my question, I'm looking for a new range to add to the regex, not a specific symbol. Any suggestions? – Lior Magen Nov 16 '16 at 09:46
  • 1
    Questions asking us to recommend or find an off-site resource are off-topic for Stack Overflow. – Sayse Nov 16 '16 at 09:50
  • I'm not looking for an off-site resource or something like that, just asking if any one here can help me with figuring out how should I change the regex values that I'm using in order to detect these new emojis. – Lior Magen Nov 16 '16 at 09:53
  • Since these days Unicode is constantly being expanded to support new emoji, this is something you'll have to continuously keep up to date with. Perhaps a different approach to dealing with whatever problem you're trying to solve here would be better, one which doesn't require you to keep amending a regex? – deceze Nov 16 '16 at 09:53
  • 1
    @deceze Yes! This is exactly what I hope to get to but I'm not familiar enough with how to figure out how to change the regex value in order to detect new emojis. I know how to get the emoji value just don't know how to modify the code Iv'e provided so it'll detect this new emoji. I know it will need to be updated frequently, just how to start with this. – Lior Magen Nov 16 '16 at 09:55

0 Answers0