From 1e5b1314f459c2197662c1222e16ba0bc81cf75a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Mon, 5 Feb 2024 21:45:31 +0200 Subject: [PATCH 1/2] Change regex/iregex to use re.search instead of re.match This is BREAKING CHANGE --- plexapi/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plexapi/base.py b/plexapi/base.py index f6aaba53e..586414591 100644 --- a/plexapi/base.py +++ b/plexapi/base.py @@ -26,8 +26,8 @@ '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: re.search(q, v), + 'iregex': lambda v, q: re.search(q, v, flags=re.IGNORECASE), } From 71ae3cdab851d9bbfa9011feaa1cff3eb96296cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Tue, 6 Feb 2024 20:37:52 +0200 Subject: [PATCH 2/2] Also cast to bool. Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> --- plexapi/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plexapi/base.py b/plexapi/base.py index 586414591..e06717730 100644 --- a/plexapi/base.py +++ b/plexapi/base.py @@ -26,8 +26,8 @@ '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.search(q, v), - 'iregex': lambda v, q: re.search(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)), }