Remove custom regex cache and just use a weak-valued map. #2078.