You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm writing helper wrappers based on the OCaml Pcre library, and one of the things that would be useful is the ability to learn for each capture group whether, if the regexp matches, the capture group will match. I don't see any entrypoint for doing this, and truthfully I don't know enough about PCRE's regexp language to know whether it's even computable, but for simpler regexp languages it seems pretty straightforward.
I thought I'd ask here if this were something that's possible with Pcre.
The text was updated successfully, but these errors were encountered:
I would have thought, for any sensible regex, that any capture group might match - otherwise what is the point of having the capture group in the regex? Of course, one can write patterns with groups that can never match - a trivial example is /(*FAIL)(group)/ - but clearly such patterns are not useful. Or are you wanting to analyze patterns to check whether there are any unreachable groups? As Zoltan says, pattern analysis is not something PCRE goes in for. In any case, this is a general discussion rather than an issue (IMHO). There's a Google group for PCRE2 discussions.
I'm writing helper wrappers based on the OCaml Pcre library, and one of the things that would be useful is the ability to learn for each capture group whether, if the regexp matches, the capture group will match. I don't see any entrypoint for doing this, and truthfully I don't know enough about PCRE's regexp language to know whether it's even computable, but for simpler regexp languages it seems pretty straightforward.
I thought I'd ask here if this were something that's possible with Pcre.
The text was updated successfully, but these errors were encountered: