Fix incorrect use of functools.lru_cache and re.finditer() match objects