mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fixes #25: Recurse expand_pattern only if there are more ranges to unpack
This commit is contained in:
@ -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)
|
||||
|
||||
|
||||
#
|
||||
|
Reference in New Issue
Block a user