Monday, April 4, 2011

Re: Substitute via expression on matched text

On 04/04/2011 01:58 PM, Taylor Hedberg wrote:
> In other words, these lines match the regex:
>
> /^PP \d\+,\d\+/
>
> I wanted to decrement the second number in each pair by 120

To simplify Venu's solution:

:%s/^PP \d\+,\zs\d\+/\=submatch(0)-120/g

-tim

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: