fork(6) download
  1. import re
  2.  
  3. def findall_overlapped(r, s):
  4. res = []
  5. reg = r'^{}$'.format(r)
  6. for q in range(len(s)):
  7. for w in range(q,len(s)):
  8. cur = s[q:w+1]
  9. if re.match(reg, cur):
  10. res.append(cur)
  11. return res
  12.  
  13. rex = r'a\w+b'
  14. print(findall_overlapped(rex, 'axaybzb'))
Success #stdin #stdout 0.03s 27712KB
stdin
Standard input is empty
stdout
['axayb', 'axaybzb', 'ayb', 'aybzb']