You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] regex_match and regex_search should not require grouped regex #65722
Thanks for helping me figure this out for myself. I was trying to regex_match against a valid .*partial.* variable but salt refused to return a result (Either () or the variable being set as None).
Wrapping the whole regex in parenthesis as (.*partial.*) has worked around the problem.
To clarify it looks like the string result () was still indicating a successful match on a regex string without parenthesis - but using it in a jinja if statement didn't evaluate as True. The None result seemed to occur when the regex truly didn't match.
Its trivial to set a variable based on the regex_match result then test for != None, or piping more tests onto the end of the output. But that's a work around for this problem compared to having a single regex_match if statement which works without needing parenthesis in the regex string.
Fix merged and shipped in a supported release. Closing per bulk triage. Reopen if this reproduces on a currently supported release (3006.x, 3007.x, 3008.x, master).
Activity
ipaqmaster commentedon Apr 9, 2024
Thanks for helping me figure this out for myself. I was trying to regex_match against a valid
.*partial.*variable but salt refused to return a result (Either()or the variable being set asNone).Wrapping the whole regex in parenthesis as
(.*partial.*)has worked around the problem.This is on
3007.0 (Chlorine)ipaqmaster commentedon Apr 9, 2024
To clarify it looks like the string result
()was still indicating a successful match on a regex string without parenthesis - but using it in a jinjaifstatement didn't evaluate as True. TheNoneresult seemed to occur when the regex truly didn't match.Its trivial to set a variable based on the regex_match result then test for
!= None, or piping more tests onto the end of the output. But that's a work around for this problem compared to having a single regex_match if statement which works without needing parenthesis in the regex string.dwoz commentedon Jul 2, 2026
Fix merged and shipped in a supported release. Closing per bulk triage. Reopen if this reproduces on a currently supported release (3006.x, 3007.x, 3008.x, master).
Fix regex_search/regex_match Jinja filters for ungrouped patterns
Fix regex_search/regex_match Jinja filters for ungrouped patterns
Restore several dropped 3006.x fixes + adapt tests for py3.11 deps