From eade3cbd6b86d52e14f5b511f329ac86f763ce46 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 27 Jun 2016 14:12:30 -0400 Subject: [PATCH] Fixes #25: Recurse expand_pattern only if there are more ranges to unpack --- netbox/utilities/forms.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netbox/utilities/forms.py b/netbox/utilities/forms.py index 7ad41697e..260365eec 100644 --- a/netbox/utilities/forms.py +++ b/netbox/utilities/forms.py @@ -19,11 +19,11 @@ def expand_pattern(string): lead, pattern, remnant = re.split(EXPANSION_PATTERN, string, maxsplit=1) x, y = pattern.split('-') for i in range(int(x), int(y) + 1): - if remnant: + if re.search(EXPANSION_PATTERN, remnant): for string in expand_pattern(remnant): yield "{}{}{}".format(lead, i, string) else: - yield "{}{}".format(lead, i) + yield "{}{}{}".format(lead, i, remnant) #