In VIM, using search and replace like :%s/pat/repl/g
, is it possible to have a quantifier in the replace part?
As an example, replace every line matching pat
by exactly 100 #
without actually typing exactly 100 #
's into the command?
Something like
s/pat/#\{100}/g
which, however, doesn't work for me.
More generally, is it possible to replace matches by a captured amount of characters? For example replace
This 3 is a text 5
with some 2 numbers.
with
This XXX is a text XXXXX
with some XX numbers.
using something like :%s/\(\d\)/X\{\1}/g
?