Visitar URL original
1.42: `&` in CSV `if` rules broke · Issue #2352 · hledgerorg/hledger · GitHub
Skip to content

1.42: & in CSV if rules broke #2352

Closed

Description

@gassmatt

& in the regex expression of an if block raises error on CSV import unless the & is followed by a conditional block. Escaping with backslashes or enclosing & in a regex group expression (e.g., [ \&]*) has no effect.

Example CSV rule file

if
%description STOP \& SHOP
    account2 Expenses:Food and Supplies

Error Output

hledger: Error: ...chase-visa.rules:137:21:
    |
137 | %description STOP \& SHOP
    |                     ^
unexpected space
expecting conditional block

I'm using hledger-flow import and hledger 1.42, mac-aarch64. I did not have this error prior to 1.42.

Activity

  1. adept commented on Mar 11, 2025

    @adept
    Contributor

    A very quick workaround is to replace it with "." (which you probably know, but I wanted to mention it anyway)

  2. gassmatt commented on Mar 11, 2025

    @gassmatt
    Author
  3. added
    A-BUGSomething wrong, confusing or sub-standard in the software, docs, or user experience.
    docsDocumentation-related.
    csvThe csv file format, csv output format, or generally CSV-related.
    regressionA backwards step, indicating a weakness in our QA. We don't like these.
    on Mar 11, 2025
  4. simonmichael commented on Mar 11, 2025

    @simonmichael
    Member

    Sorry for breaking your rules!

    I guess this is due to #2333, even though we tried to avoid breaking rules with &. @thomie would you have time to investigate ?

  5. simonmichael commented on Mar 11, 2025

    @simonmichael
    Member
  6. changed the title [-]unescapable & in CSV rules[/-] [+]1.42: & in CSV rules broke, unescapable[/+] on Mar 11, 2025
  7. changed the title [-]1.42: & in CSV rules broke, unescapable[/-] [+]1.42: & in CSV rules no longer works, unescapable[/+] on Mar 11, 2025
  8. thomie commented on Mar 11, 2025

    @thomie
    Contributor

    I will have a look tomorrow.

  9. thomie commented on Mar 12, 2025

    @thomie
    Contributor

    Sorry about that! The fix is easy enough, but I should have caught this earlier. Pull request in #2353.

  10. simonmichael commented on Mar 12, 2025

    @simonmichael
    Member

    @gassmatt, would you be able to confirm the fix works for you ? It's in the binaries at https://github.com/simonmichael/hledger/releases/tag/nightly .

  11. 11 remaining items

  12. pinned this issue on Apr 2, 2025
  13. changed the title [-]1.42: & in CSV if rules no longer works[/-] [+]1.42 regression: & in CSV if rules no longer works[/+] on Apr 2, 2025
  14. added
    annoyance4-majorMajor usability/doc bug, or any regression or crash.
    affects4-manyAffects potentially a significant number of users.
    on Apr 2, 2025
  15. changed the title [-]1.42 regression: & in CSV if rules no longer works[/-] [+]1.42 regression: csv: & in if rules no longer works[/+] on Apr 2, 2025
  16. changed the title [-]1.42 regression: csv: & in if rules no longer works[/-] [+]1.42 regression: csv: if rules: & within match patterns broke[/+] on Apr 2, 2025
  17. changed the title [-]1.42 regression: csv: if rules: & within match patterns broke[/-] [+]1.42 regression: csv: & within if rule regexps broke[/+] on Apr 2, 2025
  18. changed the title [-]1.42 regression: csv: & within if rule regexps broke[/-] [+]1.42 regression: csv: & within `if` rule regexps broke[/+] on Apr 2, 2025
  19. changed the title [-]1.42 regression: csv: & within `if` rule regexps broke[/-] [+]1.42 regression: csv: `&` within `if` rule regexps broke[/+] on Apr 2, 2025
  20. changed the title [-]1.42 regression: csv: `&` within `if` rule regexps broke[/-] [+]1.42: csv: `&` within `if` rule regexps broke[/+] on Apr 2, 2025
  21. changed the title [-]1.42: csv: `&` within `if` rule regexps broke[/-] [+]1.42-1.42.1: csv: `&` within `if` rule regexps broke[/+] on May 17, 2025
  22. changed the title [-]1.42-1.42.1: csv: `&` within `if` rule regexps broke[/-] [+]1.42: csv: `&` within `if` rule regexps broke[/+] on May 17, 2025
  23. changed the title [-]1.42: csv: `&` within `if` rule regexps broke[/-] [+]1.42: `&` in CSV `if` rules broke[/+] on May 17, 2025
  24. unpinned this issue on Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-BUGSomething wrong, confusing or sub-standard in the software, docs, or user experience.affects4-manyAffects potentially a significant number of users.annoyance4-majorMajor usability/doc bug, or any regression or crash.bountyThar's some kind o' loot on offer..csvThe csv file format, csv output format, or generally CSV-related.docsDocumentation-related.regressionA backwards step, indicating a weakness in our QA. We don't like these.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions