Thursday, September 3, 2009

RE: how to re-use the pattern matched in parenthes

>abc(123);
>xyz

[to]

>abc(123);
>123
>xyz

Use (untested, but should work)

:g/\(abc(\)\(\d*\)\().*\)/s//\1\2\3\r\2

and salt/pepper to taste.

Ie, split the "abc" line into 3 parts: prefix, number, and suffix. Put
back the original 3 parts, add a return, and add the number.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

No comments: