Hi, >In a C Source file, >there are a bunch of variables as > >tv[1] >tv[2] >.... >tv[234] > > >I want to replace them such that first '[' is replaced by '_' and >second one deleted. So file has replaced new names as > >tv_1 >tv_2 >... >tv_234 > >can somebody help me with this? > >%s/tv\[/tv_/g >replaces he first but how to distinguish the second from other similar >cases. >
i would use: %s~tv\[\([^\]]*\)\]~tv_\1~g which means replace "tv" followed by "[" followed by anything except a "]" and save the content between "[" and "]" in \1 by tv_ and the saved content in \1. Kind regards Chris --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
