From 2fc8f76661ce80084ecddda20d356a2e1e16de1f Mon Sep 17 00:00:00 2001 From: Jeremy Zimmerman Date: Thu, 22 Jun 2017 14:34:54 -0700 Subject: [PATCH] regular expression pattern fix This fixes reversed `string, pattern` to correct `re.search(pattern, string, flags=0)` format. --- sanic/router.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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)