diff --git a/sanic/router.py b/sanic/router.py index 691f1388..b25b610d 100644 --- a/sanic/router.py +++ b/sanic/router.py @@ -163,10 +163,10 @@ class Router: parameters.append(parameter) # Mark the whole route as unhashable if it has the hash key in it - if re.search(r'(^|[^^]){1}/', pattern): + if re.search(pattern, r'(^|[^^]){1}/'): properties['unhashable'] = True # Mark the route as unhashable if it matches the hash key - elif re.search(r'/', pattern): + elif re.search(pattern, r'/'): properties['unhashable'] = True return '({})'.format(pattern)