Skip to content

Instantly share code, notes, and snippets.

@naotokui
Created May 19, 2017 04:21
Show Gist options
  • 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
@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