Search notes:

vim script: submatch

"
" ..\run_.bat submatch
"
redir > submatch.out

let s:txt = 'foo 42 bar'
let s:replaced = substitute(s:txt, '\v(\d)(\d)', '\=submatch(1) + submatch(2)', '')
echo s:replaced

redir END
q
Github repository about-vim, path: /vimscript/functions/submatch.vim

See also

Vim: built in functions
VIM script

Index