Scoop icon indicating copy to clipboard operation
Scoop copied to clipboard

[Feature] A way to access `$Matches.Groups[uint].Captures[uint]` within `autoupdate`

Open brian6932 opened this issue 1 year ago • 3 comments

Feature Request

Is your feature request related to a problem? Please describe.

Currently, when making capture groups, we can only access $Matches.Groups[uint].Value, sometimes you may need to access the actual Captures in each group, for example.

(foo){2}(bar)

So how do we access the foos? We can't. $Matches.Groups[1].Value is foofoo, and $Matches.Groups[2].Value is bar. We need $Matches.Groups[1].Captures[0] & $Matches.Groups[1].Captures[1]. The only thing you can actually do at the moment's copy-paste the regex again, and add named groups, that's not good.

Describe the solution you'd like

So this is the tough part. We'd want to use a character delimiter that can't appear in URIs to delimit the variable in the autoupdate.url, so maybe something like $match1\capture1 or $match1$capture1.

brian6932 avatar Apr 19 '24 07:04 brian6932

I did manage to get around this issue, by using single line mode and multiple groups

'(?s)your_pattern_here'

Maybe that helps

tree-s avatar Jun 11 '24 15:06 tree-s

'(?s)your_pattern_here'

Doesn't work for me, I was already using multiple named groups to get around it. The point of the issue's not to have to do that, the Group data's already in memory, just needs to be accessed.

brian6932 avatar Jun 11 '24 18:06 brian6932

Doesn't work for me, I was already using multiple named groups to get around it. The point of the issue's not to have to do that, the Group data's already in memory, just needs to be accessed.

Your not wrong 😅 Just posting here in you or some one else finds this useful. It defiantly would be much easier and intuitive the way you describe it and would have saved me a bunch of time trying to force a work around.

tree-s avatar Jun 11 '24 18:06 tree-s