Thanks for the explanation.

Still I think it is weird that the argument $2 is passed to the procedure call rather than the value of $2. I would have expected this when using $!2 or $ $+ 2.
In example I would have expected: $regsubex($1,/(a)/g, [ $2 ] )

Nice examples in your post as well btw.