Skip to content

Fix/exact text matching empty target - #2882

Open
Joel (aspire488) wants to merge 2 commits into
microsoft:mainfrom
aspire488:fix/exact-text-matching-empty-target
Open

Joel (aspire488) wants to merge 2 commits into
microsoft:mainfrom
aspire488:fix/exact-text-matching-empty-target

Conversation

@aspire488

@aspire488 Joel (aspire488) commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Description

Tests and Documentation

Description

Fixes an edge case in "ExactTextMatching" where an empty or whitespace-only target could incorrectly produce a match.

Python treats an empty string as being contained in every string (""" in text"), so an empty target could result in a false positive. This is particularly relevant when matching values that may default to an empty string.

Changes

  • Reject empty targets in "ExactTextMatching.is_match()".
  • Normalize whitespace before checking whether the target is empty.
  • Add regression coverage for both empty and whitespace-only targets.

Related Issue

Closes #2881

Validation

Added unit tests covering:

  • "target="""
  • "target=" \n ""

Non-empty matching behavior remains unchanged.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ExactTextMatching reports a match for an empty or whitespace-only target

1 participant