mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add one-versus-many-matches logic to network filter plugin (#30511)
* Add one-versus-many-matches logic * Fixed indentation (tabs ==> spaces)
This commit is contained in:
parent
d23af439ca
commit
9aa1da23f0
1 changed files with 4 additions and 1 deletions
|
@ -56,6 +56,9 @@ def re_matchall(regex, value):
|
||||||
obj = {}
|
obj = {}
|
||||||
if regex.groupindex:
|
if regex.groupindex:
|
||||||
for name, index in iteritems(regex.groupindex):
|
for name, index in iteritems(regex.groupindex):
|
||||||
|
if len(regex.groupindex) == 1:
|
||||||
|
obj[name] = match
|
||||||
|
else:
|
||||||
obj[name] = match[index - 1]
|
obj[name] = match[index - 1]
|
||||||
objects.append(obj)
|
objects.append(obj)
|
||||||
return objects
|
return objects
|
||||||
|
|
Loading…
Reference in a new issue