I am trying to run a command on every occurrence of a search match. So, If i have some thing like this where a search match matches only these two anchor tags,
.................. <a src="****" ></a>
......... <a src="****"></a>
I want to run a command that changes it to,
.................. <a class = "bodyclass" src="****" ></a>
......... <a class="bodyclass" src="****"></a>
So, how can I run a command on all the search matches? The only way I can think of is to go to the search match and do a :execute 'normal! Wiclass="bodyclass" '
to insert the class
in the tag.
I am not looking for g
command here as that operates on the lines and not on the matches directly unless there is a way I can get this functionality with g
itself.
Any ideas ?
:&s/<a \zs\zesrc="/class="bodyclass" /
? See the docs for help on\zs
and\ze
if you don't know of these from before.