About Regular Expression

2010-07-13 Thread Aaron Guo
I have a file with some numbers like below: - 12 31 4324 321 312 432432 213 321 - And I want to plus every number 5 by using regular expression, how to do it? -- Aaron Guo -- You received this message from the vim_use maillist. Do not top-post

Re: About Regular Expression

2010-07-13 Thread Aaron Guo
Thank you~ I tried before: :%s/\d\+/\=\0+2/g but \0 failed, it said Invalid expression On Tue, Jul 13, 2010 at 5:12 PM, chopinx04 chopin...@gmail.com wrote: This seems to do the trick: :%s/\d\+/\=submatch(0)+2/g Bye, 0x412E Il 07/13/2010 10:07 AM, Aaron Guo ha scritto: I have a file

Re: About Regular Expression

2010-07-13 Thread Aaron Guo
to each number? And the addition result will replace the previous number? If that's what you want, you can try: :1,$s/^.*$/\=printf(%d, getline(.)+5)/ On Tue, Jul 13, 2010 at 4:07 PM, Aaron Guo guoyi...@gmail.com wrote: I have a file with some numbers like below