simonmichael / hledger

Robust, fast, intuitive plain text accounting tool with CLI, TUI and web interfaces.
https://hledger.org
GNU General Public License v3.0
3.01k stars 321 forks source link

csv rules: support easy negation of conditions #2054

Open simonmichael opened 1 year ago

simonmichael commented 1 year ago

https://hledger.org/dev/hledger.html#matchers : "There's not yet an easy syntax to negate a matcher." We should have this, for if blocks (and possibly if tables ?)

simonmichael commented 8 months ago

Since 1.32 you can negate a matcher by prepending !, but it's unfinished:

Combining matchers

When an if block has multiple matchers, they are combined as follows:

  • By default they are OR'd (any one of them can match)
  • When a matcher is preceded by ampersand (&) it will be AND'ed with the previous matcher (both of them must match)
  • Added in 1.32 When a matcher is preceded by an exclamation mark (!), the matcher is negated (it may not match).

Currently there is a limitation: you can't use both & and ! on the same line (you can't AND a negated matcher).