I have a big string "a" and I want to extract all words with double characters from there. I need words as output (not lines or characters). I tried simple things like this:
re.findall(r'\b.*([A-Za-z])\1.*\b', a)
which gives a list of letters.
I also tried this:
pat='(\w*)\1'
def f(a, pat):
pat = r'(\w*%s\w*)' % pat
return re.findall(pat, a)
print (f(a,pat))
It gave me empty list. So I have two problems: 1) How to return words? 2) What regex to use to select words with double letters (like 'look', 'settle' etc).