Skip to content

Commit 930101d

Browse files
Merge pull request #158 from Flagsmith/release/3.3.1
Release 3.3.1
2 parents e071124 + 4c3cdc3 commit 930101d

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

flag_engine/segments/models.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ def evaluate_not_contains(self, trait_value: typing.Iterable) -> bool:
5656
return self.value not in trait_value
5757

5858
def evaluate_regex(self, trait_value: str) -> bool:
59-
return re.compile(str(self.value)).match(trait_value) is not None
59+
return (
60+
trait_value is not None
61+
and re.compile(str(self.value)).match(str(trait_value)) is not None
62+
)
6063

6164
def evaluate_modulo(self, trait_value: typing.Union[str, int, float, bool]) -> bool:
6265
if type(trait_value) not in (int, float):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name="flagsmith-flag-engine",
5-
version="3.3.0",
5+
version="3.3.1",
66
author="Flagsmith",
77
author_email="[email protected]",
88
packages=find_packages(include=["flag_engine", "flag_engine.*"]),

tests/unit/segments/test_segments_models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060
(constants.REGEX, "foo", r"[a-z]+", True),
6161
(constants.REGEX, "FOO", r"[a-z]+", False),
6262
(constants.REGEX, "1.2.3", r"\d", True),
63+
(constants.REGEX, 1, r"\d", True),
64+
(constants.REGEX, None, r"[a-z]", False),
6365
(constants.IN, "foo", "", False),
6466
(constants.IN, "foo", "foo, bar", True),
6567
(constants.IN, "foo", "foo", True),

0 commit comments

Comments
 (0)