Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
)> in regex results in stuff being matched wrongly ( /)> . <(/ ) #6220
Result (2015.12 … 2017.03):
Result (2017.04.3, HEAD(701dab3))
｢bc｣ is definitely wrong and #<failed match> is kinda right.
On Tue, 02 May 2017 14:51:47 -0700, firstname.lastname@example.org wrote:
Given it can never match, a compile-time error might be the best solution.
Another case that might benefit from being complained about with an error. Only the last capture is used:
<Zoffix__> star: use Test; is-deeply ~('123456789foobarMEOWS'~~ /<(fo)> o <( ba)> r/), 'foba', 'case 3';
Just as a historical perspective, failed matches used to be Match objects where .from > .to, and iirc NQP still does it that way. When funny placement of )> and <( tricks the regex engine into such cases.
Maybe a sane-ish approach would be to change <( to only ever increase .from, and )> to only decrease .to.
A static compile-time error would be nice too, but I guess it won't be able to capture all cases, like when <( and )> are only used in some branches of an a conjunction or disjunction.