Skip to content

This closes #2411, anchor the wildcard match of the lookup functions - #2418

Merged
xuri merged 3 commits into
qax-os:masterfrom
PhilflowIO:2411-vlookup-exact-match
Oct 10, 2026
Merged

xuri merged 3 commits into
qax-os:masterfrom
PhilflowIO:2411-vlookup-exact-match

Conversation

@PhilflowIO

Copy link
Copy Markdown
Contributor

PR Details

Description

Adds matchPatternWholeText, which matches the pattern against the whole text, and uses it in the wildcard branch of compareFormulaArg. Without a wildcard in the lookup value it compares the strings directly; with one it anchors the regular expression at both ends.

matchPattern is left alone, so FIND and SEARCH keep reporting any occurrence.

Related Issue

Closes #2411

Motivation and Context

compareFormulaArg used matchPattern, which reports any occurrence inside the cell. VLOOKUP, HLOOKUP and XLOOKUP therefore matched a substring and returned a value from the wrong row, without an error. #2267 applied the same anchoring to the SUMIF/COUNTIF criteria; compareFormulaArg is the other place that needs it.

How Has This Been Tested

New test TestCalcLookupWildcardMatch: exact matches, substring lookup values, the empty lookup value, * and ? wildcards for VLOOKUP, HLOOKUP and XLOOKUP, and FIND/SEARCH to pin the unanchored behaviour they need.

go test ./... passes on go1.26.8 linux/amd64. gofmt -s -l . is empty.

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

…tions

`compareFormulaArg` used `matchPattern`, which reports any occurrence inside the cell. VLOOKUP, HLOOKUP and XLOOKUP therefore matched a substring and returned a value from the wrong row, without an error. qax-os#2267 applied the same anchoring to the SUMIF/COUNTIF criteria; `compareFormulaArg` is the other place that needs it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: PhilflowIO <tech@philflow.io>
@xuri xuri added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 21, 2026
Comment thread calc.go
@codecov

codecov Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.72%. Comparing base (0434413) to head (f2e0c89).
⚠️ Report is 17 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2418      +/-   ##
==========================================
- Coverage   99.72%   99.72%   -0.01%     
==========================================
  Files          32       32              
  Lines       32480    32531      +51     
==========================================
+ Hits        32391    32441      +50     
- Misses         87       88       +1     
  Partials        2        2              
Flag Coverage Δ
unittests 99.72% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xuri xuri left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for your pull request. I've made some changes based on your code branch.

@xuri
xuri merged commit 066c84b into qax-os:master Oct 10, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

Status: Bugfix

Development

Successfully merging this pull request may close these issues.

VLOOKUP and XLOOKUP match a substring of a cell instead of the whole cell

2 participants