Regular expressions in GnuCash
prl
prl at ozemail.com.au
Fri Sep 23 02:54:25 EDT 2016
Without some further tweaking, it will also match (parts of) 91234,
991234, etc... The RE needs some sort of start/end marking; in this
case, "^..re below...$" would do the job.
And I stand by my "clunky" description, even though there probably
aren't cleaner REs that will work for that match example. Regular
expressions are just a bit clumsy to use to do this sort of thing, even
if they can be made to work.
Peter
On 23/09/2016 15:12, Dean Gibson wrote:
> 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
>
> _______________________________________________
> gnucash-user mailing list
> gnucash-user at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-user
> -----
> 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