You are viewing a single comment's thread. Return to all comments →
You can use re.match, that's not the problem. The problem is if you are using \w, because Python counts underscores and this problem does not.
import re S=input() #print(S) m=re.match(r'.*?([a-z0-9A-Z])\1', S) if m is None: print(str(-1)) else: print(m.group(1))
Seems like cookies are disabled on this browser, please enable them to open this website
Group(), Groups() & Groupdict()
You are viewing a single comment's thread. Return to all comments →
You can use re.match, that's not the problem. The problem is if you are using \w, because Python counts underscores and this problem does not.