Automatic Transactions

25 views
Skip to first unread message

Jasel17212

unread,
Jan 31, 2023, 1:00:29 PM1/31/23
to hledger
I've been wrestling with the decision to move from ledger-cli to hledger for 18+ months. Yesterday, I finally committed to making the move, and with a lot of trial and error, I managed to transition successfully. 

One thing that's really bothering me, though, is automatic transactions. I have a rule to calculate tithes on income. My preference is to have the calculation performed on anything in the Income account unless I specifically exclude it. With hledger, the regex I used with ledger-cli doesn't seem to work, and instead, I am forced to specify all of the accounts I want to include instead.

How can I achieve the ledger-cli behavior in hledger?

ledger-cli rule
= /^Income:(?!Exc1|Exc2|Exc3|Exc4|Exc5)/                  
         (Liabilities:Tithe)                   0.10    

hledger rule
= ^Income:^Income:Inc1|^Income:Inc2Gift|^Income:Inc4|^Income:Inc5
         (Liabilities:Tithe)                  *0.10

Thanks
JL 

Simon Michael

unread,
Jan 31, 2023, 2:05:29 PM1/31/23
to hle...@googlegroups.com
Welcome!

= ^income not:(foo|bar)

should do.

Reply all
Reply to author
Forward
0 new messages