hledger icon indicating copy to clipboard operation
hledger copied to clipboard

[feature] supporting lookarounds

Open pmiam opened this issue 1 year ago • 1 comments

I want to try adding support for regex lookarounds to the query engine. Their main use is to match transactions that contain specified tag values and no others.

As Simon pointed out to me in https://github.com/simonmichael/hledger/issues/2095#issuecomment-2247534939_ this functionality would be best achieved with negative lookaheads.

In that thread, I was able to abuse character classes to query for transactions containing postings tagged with different values sharing no letters in common. This is not a reliable nor intuitive method.

I've just started a fork of regex-tdfa with positive auspices from Andreas Abel where I'll try adding the necessary features upstream.

I'll use this issue to discuss details specific to hledger. This feature may need to become a separate dependency or hledger extension instead of enjoying upstream support, but I prefer to avoid that outcome.

pmiam avatar Sep 19 '24 17:09 pmiam

Cool. I would welcome more power in regexes generally, especially if it can land in the maintained regex-tdfa.

On #2095 we could also explore the alternative of making hledger queries more powerful, if you like.

simonmichael avatar Sep 25 '24 07:09 simonmichael