Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regular expression is too large error with ?+ #12

Open
fredrik-hammar-dd opened this issue Aug 11, 2016 · 2 comments
Open

Regular expression is too large error with ?+ #12

fredrik-hammar-dd opened this issue Aug 11, 2016 · 2 comments

Comments

@fredrik-hammar-dd
Copy link

I was trying out the ?+ syntax but found it quickly builds too large regexes. I got Syntax error: regular expression is too large with the following:

    ?+"computeNodeAssignmentChange"
    ?+"callerRequestId":"6"
    ?+"eventTime"
    ?+"result":"ng"
    ?+"errno":"deregistrationFail"
    ?"additionalInfo":"License deregistration failed for vCPE ebuilding1aive901100, ebuilding1aive901200"

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.

@hawk
Copy link
Owner

hawk commented Aug 12, 2016

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?

@fredrik-hammar-dd
Copy link
Author

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 [email protected]
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//issues/12#issuecomment-239389281, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHubjy3IzDp-I-PUqxdjtx1elqXjQU25ks5qfC2JgaJpZM4JiQiD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants