Vim Regex substitute question -


Trying to replace all "-" characters (beginning of the lines) with "=" in "VIM"

Replace "-----" with "=====" or replace "----------" instead of "==========" < / P>.

I made this regex:

 % s / ^ - \ {2,} / = ???? / G   

Does anybody know how I can repeat the "=" replacement? (What do I have to do after "=")

Try it out:

 :% s / ^ - \ {2,} / \ = option (deposit (0), '-', '=', 'g') /   

or :

 :% s / ^ - \ {2,} / \ = repeat ('=', lane (deposit (0)) /   

See : sub-replace for more details - \ = help.

Comments