Skip to content

Instantly share code, notes, and snippets.

@naotokui
Created May 19, 2017 04:21
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naotokui/ecce71bcc889e1dc42d20fade74b61e2 to your computer and use it in GitHub Desktop.
Save naotokui/ecce71bcc889e1dc42d20fade74b61e2 to your computer and use it in GitHub Desktop.
find unicode emoji in python regex
import re
emoji_pattern = re.compile(
u"(\ud83d[\ude00-\ude4f])|" # emoticons
u"(\ud83c[\udf00-\uffff])|" # symbols & pictographs (1 of 2)
u"(\ud83d[\u0000-\uddff])|" # symbols & pictographs (2 of 2)
u"(\ud83d[\ude80-\udeff])|" # transport & map symbols
u"(\ud83c[\udde0-\uddff])" # flags (iOS)
"+", flags=re.UNICODE)
if emoji_pattern.search(u"テスト😋"):
print True
@Mazyod
Copy link

Mazyod commented Jul 16, 2019

Why wouldn't it work for Python3? It doesn't match anything.

@nvlong198
Copy link

It does not work for Py3

@akkez
Copy link

akkez commented Dec 1, 2019

I've made a regexp with every existing emoji (gist)

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