-
Notifications
You must be signed in to change notification settings - Fork 6
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
Error in repeated capturing group #2
Comments
@ysard Thanks for your interest. I agree that the capture should be the last character of the repitition. Currently
Note that The problem should be something like
Current implementation collects |
Thank you for your quick responses; I'm proposing a pull request that could allow the following behavior. Basically if a group has already been encountered (same idx) (because of a logical OR), the previous possible position is overwritten by the current one. If a group has 2 propositions, p_x = 0 disappears from the SMT in favor of p_x = 1.
And :
But I encounter another problem (not related to my modifications, but annoying for this functionality):
This shouldn't be accepted: assert re.match(r"^(ab|defgh)?\1$", "abababa") is None Because of that, the following test fails: self.do_test(r"(ab|defgh){1}\1", 7, False)
# Expected:
# abab
# defghdefgh
# Not expected:
# abdefgh
# defghab
# Nor (the problem is here):
# abababa |
Hi, I encounter a problem with this not supported regex syntax:
^(A|B){2}-\1$
The parser fails silently until the solver returns None.
I don't know how to tweak the grammar to support this.
The question is:
What should match a back reference to a capture group followed by a quantifier ?
What character should end the string
AB-
?A
,B
orAB
?Following the advise here: https://regex101.com/
So the capture should be the content of the last repetition, so in the example, it should be
AB-B
.Python implementation is ok with this:
The text was updated successfully, but these errors were encountered: