Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

[UFC] Use partial instead of full match for regex #37

Merged
merged 3 commits into from
May 14, 2024

Conversation

schmit
Copy link
Contributor

@schmit schmit commented May 14, 2024

Motivation and Context

Unlike other SDKs, Python currently uses full match search for regex rather than partial match

Description

Switch to using partial match

How has this been tested?

Updated tests and global tests

@schmit schmit requested a review from aarsilv May 14, 2024 16:22
@@ -143,6 +143,27 @@ def test_evaluate_condition_matches():
)


def test_evaluate_condition_matches_partial():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

@@ -49,11 +49,11 @@ def evaluate_condition(
if subject_value is not None:
if condition.operator == OperatorType.MATCHES:
return isinstance(condition.value, str) and bool(
re.match(condition.value, str(subject_value))
re.search(condition.value, str(subject_value))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@schmit schmit merged commit b7ec99b into main May 14, 2024
4 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants