hledger icon indicating copy to clipboard operation
hledger copied to clipboard

`areg` account pattern returns only first match

Open rrrnld opened this issue 7 months ago • 2 comments
trafficstars

Then using areg, only the transactions for the first account matching the pattern are returned. This is inconsistent with other commands, where matching on all accounts is performed. The hledger help areg page mentions "a single account" and areg does not allow performing matches using the full query syntax, but I would argue the behavior is confusing nonetheless.

I stumbled over this because I have two accounts: Assets:Salad and Asset:Salads and was wondering where some of the transactions went.

To reproduce, use this test.ledger:

2025-04-23 * Foo
  A:Bb                                                  100.00 EUR
  X                                                    -100.00 EUR

2025-04-23 * Foo
  A:Bbb                                                 100.00 EUR
  X                                                    -100.00 EUR

This is the inconsistency I am speaking of:

# hledger -f test.ledger reg :B
2025-04-23 One                                                         A:Bb                                                           100.00 EUR    100.00 EUR
2025-04-23 Two                                                         A:Bbb                                                          100.00 EUR    200.00 EUR

# hledger -f test.ledger areg :B
Transactions in A:Bb and subaccounts:
2025-04-23 One                                                         X                                                              100.00 EUR    100.00 EUR

rrrnld avatar Apr 23 '25 06:04 rrrnld