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

Re: About Regular Expression

2010-07-13 Thread Yang Zhou
Hi Aaron, First of all, I don't know what you mean I think you should polish your English at first. I guess perhaps you mean add the number 5 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)/

Re: About Regular Expression

2010-07-13 Thread chopinx04
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 with some numbers like below: - 12 31 4324 321 312 432432 213 321 - And I want to plus every number 5 by using

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
Thanks~ you let me know vim allowd to use printf. My English... lol... On Tue, Jul 13, 2010 at 5:33 PM, Yang Zhou zhouyang...@gmail.com wrote: Hi Aaron, First of all, I don't know what you mean I think you should polish your English at first. I guess perhaps you mean add the number 5 to

Re: About Regular Expression

2010-07-13 Thread Tony Mechelynck
On 13/07/10 10:07, Aaron Guo wrote: 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