\0 inside $regsub returns all of the matches (not the captures, the full matches) sticked together, is this an undocumented feature or a bug? //var %a | echo -ag $regsub(@ab@cd,/@([a-z])([a-z])/g,<\0>,%a) %a
The help file has a pretty wrong terminology about regex. A regex match and a capture are very different, Could it be improved?.
$regex does not mention that it can return a negative value and how to interpret it, the returned value of a function and what they mean is important; the page in general does not mention how to handle regex error at all with $regerrstr and negative values.
$regml() says it's about matches when it's should be talking about capture groups.
Same for $regmlex() which is even more vague, here is a suggestion:
$regmlex([name], M, N)
This identifier allows you to retrieve the captured groups for a given match, where M is the Mth match number and N is the Nth captured group number for that match. If N is not specified, it defaults to 1.
This identifier supports the same properties as $regml().
\t is described as 'match text', but \t returns capture group values, not match (it actually returns the same value as $regml(\n). \t is equal to \1 (which is the proper thing to use to get the first captured group per match) when there's only one match, and when there's multiple match, if you have more than one capturing group per match, \t is pretty meaningless as it doesn't return anything consistent).
\a is described as 'all match items' which doesn't mean anything, \a returns all of the captured groups made for all the matches, space separated.
I made a suggestion also about getting full matches, which is really the basic information you can get out of a match, i feel like it's close with \0 there in $regsub, but having it in $regmlex(name,Mth,-1) would be great.