Sean wrote: > For example, I have a text file in which > there are a lot of expressions in the following form: > > id = number > > id: [a-z]+ > number: [0-9]+ > > I want to rewrite these expressions into this form > > (set id number) > > is it possible to do this in vim?
You may want to reaed :help pattern :help :s The command you're looking for is :s/\(\l\+\)\s*=\s*\(\d\+\)/(set \1 \2)/ You match the id '\(\l\+\)' and the number \(\d\+\), separated by the equal sign \s*=\s*, then replace it with (set \1 \2), where \1 \2 refer to the 'id' and 'number' matches enclodes in \(...\). -- Andreas. --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
