fork download
  1. import re
  2. strs = ['dad at home', 'eat apple', 'he never ate maple', 'because he hate it']
  3.  
  4. def foo(p,i):
  5. return False if p.search(i) else True
  6.  
  7. word = 'at'
  8. pat = re.compile(r'[a-z]{}[a-z]'.format(word))
  9. print([foo(pat,i) for i in strs])
Success #stdin #stdout 0.04s 9556KB
stdin
Standard input is empty
stdout
[True, True, True, False]