Closed nitely closed 11 months ago
Changes to support both the old APIs and new APIs for a while:
I think I've not given the rational to remove the Captures all group repetitions (not just the last one)
feature anywhere, so I'll do it here.
In order to capture all of the repetitions in re"(\w)+"
a full parse tree of submatch (capture group) boundaries needs to be generated. The tree is usually small except when it's not. The main issue is the space complexity is O(N*M)
where N is the text length, and M is the regex length. While this is not unbounded, it may be prohibitive, more so when matching untrusted text. Keeping only the last repetition submatch makes space complexity O(N*M)
where N is the regex length and M the number of submatches (both usually known at compile time).
Why not provide both options? It's a lot of additional complexity.
What if I need all captures?
You can do as in the rest of languages, match
and then findAll
.
API spec:
The
Captures all group repetitions (not just the last one)
feature is removed, we capture the last repetition. This is a breaking change, and it will break some of the APIs. The rest of APIs are deprecated or removed.