use cache for regex