Fix #106: node tag matching.

Text values was treated as regular expressions.
This commit is contained in:
Sergey Vartanov 2022-01-26 09:40:53 +03:00
parent 5ecbb3f349
commit 60836bf2f7

View file

@ -68,11 +68,12 @@ def is_matched_tag(
return MatchingType.MATCHED_BY_WILDCARD, []
if tags[matcher_tag_key] == matcher_tag_value:
return MatchingType.MATCHED, []
matcher: Optional[re.Match] = re.match(
matcher_tag_value, tags[matcher_tag_key]
)
if matcher:
return MatchingType.MATCHED_BY_REGEX, list(matcher.groups())
if matcher_tag_value.startswith("^"):
matcher: Optional[re.Match] = re.match(
matcher_tag_value, tags[matcher_tag_key]
)
if matcher:
return MatchingType.MATCHED_BY_REGEX, list(matcher.groups())
return MatchingType.NOT_MATCHED, []