Hi all,
How can you get the capture names of a Regex
you don't know beforehand ?
It seems not possible from a sole Captures<'t>
struct. You can access captured values by index, so it's perfectly ok for unnamed capture groups. And access by name provided you already know the capture group name.
The only way I found is to get back to the Regex
structure with the captures_names()
method. But if you only have the Captures<'t>
you've got from the captures()
method, it seems impossible. However, this information is found in a Captures<'t>
struct.
I'm using a function which is only returning a Captures<'t>
struct, but not the original re
.
Any hint welcome