I have a list of codes of emoticons inside a file UTF32.red.codes
in plain text. The plain content of the file is
\U0001F600
\U0001F601
\U0001F602
\U0001F603
\U0001F604
\U0001F605
\U0001F606
\U0001F609
\U0001F60A
\U0001F60B
Based on question, my idea is to create regular expression from the content of the file in order to catch emoticons. This is my minimal working example
import re
with open('UTF32.red.codes','r') as emof:
codes = [emo.strip() for emo in emof]
emojis = re.compile(u"(%s)" % "|".join(codes))
string = u'string to check \U0001F601'
found = emojis.findall(string)
print found
found
is always empty. Where I am wrong? I am using python 2.7