Breaking: Change regex/iregex to use re.search instead of re.match (#1358)

* Change regex/iregex to use re.search instead of re.match

This is BREAKING CHANGE

* Also cast to bool.

Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>

---------

Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
This commit is contained in:
Elan Ruusamäe 2024-02-18 00:35:25 +02:00 committed by GitHub
parent 26447d1931
commit 7c99d4af05
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -26,8 +26,8 @@ OPERATORS = {
'endswith': lambda v, q: v.endswith(q),
'iendswith': lambda v, q: v.lower().endswith(q),
'exists': lambda v, q: v is not None if q else v is None,
'regex': lambda v, q: re.match(q, v),
'iregex': lambda v, q: re.match(q, v, flags=re.IGNORECASE),
'regex': lambda v, q: bool(re.search(q, v)),
'iregex': lambda v, q: bool(re.search(q, v, flags=re.IGNORECASE)),
}