Fixed regex typo

This commit is contained in:
Jeremy Stretch 2016-05-20 15:40:44 -04:00
parent bbdc7dccba
commit 108db82d1c

View File

@ -523,7 +523,7 @@ def device(request, pk):
if re.match('.+[0-9]+$', device.name):
# Strip 1 or more trailing digits (e.g. core-switch1)
base_name = re.match('(.*?)[0-9]+$', device.name).group(1)
elif re.match('.+\d[a-z]+$', device.name.lower()):
elif re.match('.+\d[a-z]$', device.name.lower()):
# Strip a trailing letter if preceded by a digit (e.g. dist-switch3a -> dist-switch3)
base_name = re.match('(.*\d+)[a-z]$', device.name.lower()).group(1)
else: