I have data split into fileids. I am trying to go through the data per fileid and search for emoticons :(
and :)
as defined by the regex. If an emotico
It looks to me like your regex is working, and that m
should indeed not be None
.
>>> re.search('^(:\(|:\))+$', ':)').group()
':)'
>>> re.search('^(:\(|:\))+$', ':)').group()
':)'
>>> re.search('^(:\(|:\))+$', ':):(').group()
':):('
>>> re.search('^(:\(|:\))+$', ':)?:(').group()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'group'
However, a few things are questionable to me.