Added caching of regex