Re: Automated transactions with parantheses inside regex
Oops, sorry. I realize you're talking about my reply to Jostein. It had a typo! What I meant to write back then was = expr (account =~ /^Assets:Livret A/ or account =~ /^Assets:LinXea/) and > amount > 0.0 -- --- You received this message because you are subscribed to the Google Groups "Ledger" group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Automated transactions with parantheses inside regex
Thanks for the suggestion Yuri. For the regex I made sure it matches what I want or didn't match what I didn't want on an online parser. However your suggestion still doesn't work: While parsing value expression: > account =~ /^Assets:(Boursorama Livret A|LinXea > > While parsing automated transaction: > > = expr account =~ /^Assets:(Livret A|LinXea)/ and amount > 0.0 > Error: Missing '/' > As for the lookahead, I'm not that experienced with regex but I tried it on an online tester and it seemed to match what I wanted. Gonna trust you on that one though. On Thursday, March 1, 2018 at 7:57:35 AM UTC+1, Yuri Khan wrote: > > On Thu, Mar 1, 2018 at 1:44 PM, Radoslaw Jurga <radosla...@gmail.com > > wrote: > > This does work: > > > > = expr (account =~ /^Assets:?=Livret A/ or account =~ /^Assets:LinXea/) > and > > amount > 0.0 > > That regexp… I do not think it means what you think it means. > > Originally, you had a Perl regexp syntax construct (?=…) meaning a > positive lookahead assertion. If interpreted correctly, it would match > an empty substring on the condition that what follows is either > "Livret A" or "LinXea". > > After the change, what you have in the left hand branch of the “or” is > a 0-or-1 iterator on the colon, followed by a literal equal sign, > followed by Livret A. > > In any case, I don’t think you needed a lookahed assertion in the > first place. Could try with a group or a non-capturing group: > > > = expr account =~ /^Assets:(Livret A|LinXea)/ and amount > 0.0 > > = expr account =~ /^Assets:(?:Livret A|LinXea)/ and amount > 0.0 > -- --- You received this message because you are subscribed to the Google Groups "Ledger" group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Automated transactions with parantheses inside regex
Oops, actually, this doesn't seem to work. It ignores the amount > 0.0 clause. I can't figure out why. On Thursday, March 1, 2018 at 7:44:03 AM UTC+1, Radoslaw Jurga wrote: > > = expr (account =~ /^Assets:?=Livret A/ or account =~ /^Assets:LinXea/) > and amount > 0.0 > -- --- You received this message because you are subscribed to the Google Groups "Ledger" group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Automated transactions with parantheses inside regex
Hi Jostein, This doesn't work unfortunately, but you put me on the right track. This does work: = expr (account =~ /^Assets:?=Livret A/ or account =~ /^Assets:LinXea/) and amount > 0.0 On Wednesday, February 28, 2018 at 6:43:03 PM UTC+1, Jostein Berntsen wrote: > > On 28.02.18,05:26, Radoslaw Jurga wrote: > > Hi. I'm trying to do some automated transactions using the following > regex: > > > > /^Assets:(?=Livret A|LinXea)/ > > > > > > > The expression I would like to get to work is > > > > = expr account =~ /^Assets:(?=Livret A|LinXea)/ and amount > 0.0 > > > > > > > However this gives the following error: > > > > While parsing value expression: > > > account =~ /^Assets:(?=Livret A|LinXea > > > > > > While parsing automated transaction: > > > > = expr account =~ /^Assets:(?=Livret A|LinXea)/ and amount > 0.0 > > > Error: Missing '/' > > > > > > > Here are alternatives that work, but do not achieve what I am looking to > do: > > > > = expr account =~ /^Assets:Livret A/ and amount > 0.0 > > > > > This only triggers for one of the accounts. > > > > > > > = /^Assets:(?=Livret A|LinXea)/ > > > > This does not trigger for positive amounts only, but for negative too. > > > > I guess I can split it up in two automated transactions with each a > simpler > > regex. But I would like to see if there is a better solution? > > > > Will this expression work for you? > > = expr account =~ /^Assets:?=Livret A or ^Assets:LinXea/ and amount > 0.0 > > > Jostein > > -- --- You received this message because you are subscribed to the Google Groups "Ledger" group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Automated transactions with parantheses inside regex
Hi. I'm trying to do some automated transactions using the following regex: /^Assets:(?=Livret A|LinXea)/ > The expression I would like to get to work is = expr account =~ /^Assets:(?=Livret A|LinXea)/ and amount > 0.0 > However this gives the following error: While parsing value expression: > account =~ /^Assets:(?=Livret A|LinXea > > While parsing automated transaction: > > = expr account =~ /^Assets:(?=Livret A|LinXea)/ and amount > 0.0 > Error: Missing '/' > Here are alternatives that work, but do not achieve what I am looking to do: = expr account =~ /^Assets:Livret A/ and amount > 0.0 > This only triggers for one of the accounts. > = /^Assets:(?=Livret A|LinXea)/ This does not trigger for positive amounts only, but for negative too. I guess I can split it up in two automated transactions with each a simpler regex. But I would like to see if there is a better solution? Thanks. -- --- You received this message because you are subscribed to the Google Groups "Ledger" group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Is this a bug? Unknown account warning with --strict when using $account
I get a warning that I think shouldn't be there when I use the --strict option. > Warning: "Budget.dat", line 16: Unknown account 'Budget:$account' Here are the relevant lines in Budget.dat: > = /^Expenses:(?=Groceries|Rent|Utilities)/ > (Budget:$account)-1.0 When the referenced $account is parsed during execution, Budget:$account always yields accounts that are already known. So in my opinion there should be no warning and I would consider this a bug. A workaround is to add the following at the top of the Budget.dat file: > account Budget:$account Please let me know if you know better ways to deal with this situation. Thanks! -- --- You received this message because you are subscribed to the Google Groups "Ledger" group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.