Created
May 19, 2017 04:21
-
-
Save naotokui/ecce71bcc889e1dc42d20fade74b61e2 to your computer and use it in GitHub Desktop.
find unicode emoji in python regex
This file contains 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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why wouldn't it work for Python3? It doesn't match anything.