[GNC] How to create Report on Checking & Exclude one Entity ?

John Ralls jralls at ceridwen.us
Mon Nov 11 12:40:48 EST 2019


Adrien,

Ah, negative lookahead. Nice trick, but GnuCash's Find dialog rejects it with a bogus error about an invalid repetition symbol, even when there isn't one: ^(?!Open). raises the error. The PCRE docs say it's supported: http://www.pcre.org/current/doc/html/pcre2syntax.html#SEC19. Lookahead/lookbehind aren't supported in libc's regex.

Regards,
John Ralls

> On Nov 11, 2019, at 6:40 AM, Adrien Monteleone <adrien.monteleone at lusfiber.net> wrote:
> 
> John,
> 
> I don’t know of any in particular, and I couldn’t seem to find such info. I found some examples online of doing such a search with the following basic form:
> 
> ^((?!badword).)*$
> 
> It is a negative look-around, not an actual negative search.
> 
> I tried it in GnuCash to no avail. I haven’t tested it otherwise to know if it works at all, but I’d think something implements it somewhere since there were several hits offering similar advice to such questions.
> 
> Regards,
> Adrien
> 
> 
>> On Nov 10, 2019 w46d314, at 6:06 PM, John Ralls <jralls at ceridwen.us> wrote:
>> 
>> Adrien,
>> 
>> What regex implementation do you know of that has negating patterns? None of the ones I know do.
>> 
>> The Transaction report uses Guile regex which just wraps whatever libc/msvcrt was used to compile it, generally POSIX Enhanced. It doesn't support negating patterns and doesn't have an option to find transactions that don't match the provided pattern. IIRC libc regexes also don't support UTF8 character classes though they'll match explicit UTF8 characters of the same normalization just because the bytes are the same.
>> 
>> The find dialog uses glib pcre (perl-compatible regular expressions) which are considerably more powerful than POSIX ones but also don't have negating patterns. However the Find dialog has a "doesn't match" setting. Other bits of GnuCash use boost::regexes, which understands perl regex syntax. We don't use the C++ standard library because it doesn't support UTF8.
>> 
>> Regards,
>> John Ralls
> 
> _______________________________________________
> gnucash-user mailing list
> gnucash-user at gnucash.org
> To update your subscription preferences or to unsubscribe:
> https://lists.gnucash.org/mailman/listinfo/gnucash-user
> If you are using Nabble or Gmane, please see https://wiki.gnucash.org/wiki/Mailing_Lists for more information.
> -----
> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.



More information about the gnucash-user mailing list