Open fredrik-hammar-dd opened 8 years ago
Have you experienced re's execution of compiled regexps to be inefficient? (An annoying upper limit is not the same as being inefficient.)
Do you have a suggestion of a more efficient algorithm?
I have really tested it before running in to the limit, but the compiled regexp was pretty riduculous it was many screens long. Since it's all permutations the length will be O(n!).
My suggestion would be to run each regexp separately each time until they all match.
You could also compile a group like (A)|(B)|(C) and check that \1 \2 \3 is not empty, but that seems like overkill to me.
I could give it a shot to implement it. I'm not sure I'll have the time, but I am curious about the internals of Lux :-)
From: H?kan Mattsson notifications@github.com Sent: Friday, August 12, 2016 10:23:37 AM To: hawk/lux Cc: Fredrik Hammar; Author Subject: Re: [hawk/lux] Regular expression is too large error with ?+ (#12)
Have you experienced re's execution of compiled regexps to be inefficient? (An annoying upper limit is not the same as being inefficient.)
Do you have a suggestion of a more efficient algorithm?
You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/hawk/lux/issues/12#issuecomment-239389281, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHubjy3IzDp-I-PUqxdjtx1elqXjQU25ks5qfC2JgaJpZM4JiQiD.
I was trying out the
?+
syntax but found it quickly builds too large regexes. I gotSyntax error: regular expression is too large
with the following:I think this could be implemented more efficiently in code than building a gigantic regex, it is very useful in some cases. In this case, I wanted to test Json output where the order of elements is implementation specific.