I'd like to be able to, say, check the value of $1 inside the if block, to get the first backreference. However vimscript is not perl.
Is there some way to do this? I'm aware of the possibility of using \1, \2, etc., inside the regex, but I'd like to match and then use the values in subsequent statements, as is possible in perl, php, etc.
For example it would be really nice to have in the evaluated part of g// commands, so you could do things like
:g/number: \(\d\+\)/b:number += v:matches[1] " or whatever the syntax is/could be
to total the values of some number in a file.
Can this be done?
If not, is there a good reason?