Regular expressions in GnuCash

Dean Gibson gnucash.stuff at mailpen.com
Fri Sep 23 01:12:42 EDT 2016


To select everything from "1234" to "5678" (extended regular expressions):

1(2(3[4-9]|[4-9][0-9])|[3-9][0-9][0-9])|([2-4][0-9][0-9][0-9])|5([0-5][0-9][0-9])|6([0-6][0-9]|7[0-8])

or:

123[4-9]|12[4-9][0-9]|1[3-9][0-9][0-9]|[2-4][0-9][0-9][0-9]|5[0-5][0-9][0-9]|56[0-6][0-9]|567[0-8]

Both are equivalent, but the second is probably easier to understand, 
but both provide a good learning example.

Plus, after learning this, accounting will seem much easier ...

On 2016-09-22 21:43, prl wrote:
> On 23/09/2016 09:41, DaveC49 wrote:
>> Regex is a pattern matching search rather than a numerical search and 
>> is probably overkill for just finding a range of numbers however 
>> imported cheque numbers, invoice numbers etc may not also be strictly 
>> numeric or in a form for which a numerical search can be effective 
>> e.g. leading zeroes and alphabettic or symbolic content.
>
> Writing a regex to match a precise range of numbers (even if just 
> integers)  would be clunky. It's probably not a good introductory 
> exercise in regular expressions.
>
> Peter



More information about the gnucash-user mailing list