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 <[email protected] 
> <javascript:>> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to