-
-
Notifications
You must be signed in to change notification settings - Fork 394
CSV: match group references get mixed up when multiple ifs match a record #2158
Copy link
Copy link
Closed
Labels
A-BUGSomething wrong, confusing or sub-standard in the software, docs, or user experience.Something wrong, confusing or sub-standard in the software, docs, or user experience.affects4-manyAffects potentially a significant number of users.Affects potentially a significant number of users.annoyance2-minorMinor to moderate usability/doc bug, reasonably easy to avoid or tolerate.Minor to moderate usability/doc bug, reasonably easy to avoid or tolerate.csvThe csv file format, csv output format, or generally CSV-related.The csv file format, csv output format, or generally CSV-related.
Description
Metadata
Metadata
Assignees
Labels
A-BUGSomething wrong, confusing or sub-standard in the software, docs, or user experience.Something wrong, confusing or sub-standard in the software, docs, or user experience.affects4-manyAffects potentially a significant number of users.Affects potentially a significant number of users.annoyance2-minorMinor to moderate usability/doc bug, reasonably easy to avoid or tolerate.Minor to moderate usability/doc bug, reasonably easy to avoid or tolerate.csvThe csv file format, csv output format, or generally CSV-related.The csv file format, csv output format, or generally CSV-related.
When reading CSV and rules files and using REGEX expressions, if more than one
ifblock matches the same record, the REGEX group index gets mixup.Example:
Expected Result
Current Result
Note
If the rules file is modified with the following:
(note the index for matching groups (
\2and\3), then the result works as expected.More info
HLedger version:
hledger 1.32.2, mac-aarch64[Background: wish #2009, pr #2087.
Workaround: don't allow multiple ifs with capture groups to match the same CSV record. So if you use capture groups, make those regexps specific enough that at most one of them will match any given CSV record.]