a problem about regex

2008-03-09 Fir de Conversatie LegolasKiss
Hi every one. When i use printf to print the time, i use ``%6d'' instead of ``%06d'' in code: printf( %d.%6d, time_t.second, time_t.milsecond); so the log is like this now: time cost is 3. 1234 time cost is 3. 234 time cost is 3. 5 . i want to use the regular expression in vim to

Re: a problem about regex

2008-03-09 Fir de Conversatie Ben Schmidt
LegolasKiss wrote: Hi every one. When i use printf to print the time, i use ``%6d'' instead of ``%06d'' in code: printf( %d.%6d, time_t.second, time_t.milsecond); so the log is like this now: time cost is 3. 1234 time cost is 3. 234 time cost is 3. 5 . i want to use the

Re: a problem about regex

2008-03-09 Fir de Conversatie Ben Schmidt
Nico Weber wrote: I have never invoke functions in the ``esc:s/'' before. If I understand you correctly, \zs might be even easier in this context: :%s/d\.%\zs/0/g See `:h \zs`. You seem to have muddled that a bit...you have 'd' where you surely want '\d' and I'm not sure what

Re: a problem about regex

2008-03-09 Fir de Conversatie A.Politz
LegolasKiss wrote: [...] so the log is like this now: time cost is 3. 1234 time cost is 3. 234 time cost is 3. 5 . i want to use the regular expression in vim to change all spaces into ``0'',but i can't do this in one operation. my way is like this: esc:%s/\(\d\.\ *\)\

Re: a problem about regex

2008-03-09 Fir de Conversatie LegolasKiss
On 3月9日, 下午10时51分, A.Politz [EMAIL PROTECTED] wrote: LegolasKiss wrote: [...] so the log is like this now: time cost is 3. 1234 time cost is 3. 234 time cost is 3. 5 . i want to use the regular expression in vim to change all spaces into ``0'',but i can't do this

Re: a problem about regex

2008-03-09 Fir de Conversatie Ben Schmidt
:s/\v(\d\.\s*)@=\s/0/g This does work. Nice, AP. I had believed (I thought on the basis of having run some tests...) that \zs was just syntactic sugar for \@= and that they thus behaved the same way, so didn't even try it, though I thought of it. Obviously I was wrong! There may be many