Le mardi 20 février 2018 00:27:36 UTC+1, Arun E a écrit : > That is due to the "greedy" nature of ".*". Replace ".*" with ".\{-}". > > > Anycase, for a preview of what your pattern would match, you could > surround your expression of interest within \zs and \ze like > /^.*\zs\(\S\+()\)\ze > > > If you have "incsearch" set, you could immediately see what your > pattern matches. > > > Regards, > -Arun > > > On Mon, Feb 19, 2018 at 12:40 PM, Ni Va <niva...@gmail.com> wrote: > Hi, > > > > 1/Got a list mirror of file read that contains these kind of lines: > > 19 févr. 2018 15:49:09.301 Foo.BarFoo() - FIN TOTAL temps : 0,013ms > > > > > > 2/ attempt to map( the list and retrieve func and time > > > > let patfunc = '\(\S\+()\)' > > let pattime = '\(\d\+\,\d\+\)' > > let linepat = '^.*'.patfunc.'.*'.pattime.'.*$' > > > > let minitestlist = map(totaltimelist[0:10], 'substitute(v:val, linepat, > "\\1 : \\2", "")') > > > > > > > > 3/ It results in > > > > ['o():0,013',.... > > > > Why for the first backward ref I got only last char. > > > > Thank you > > Niva > > > > -- > > -- > > 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 > > > > --- > > You received this message because you are subscribed to the Google Groups > "vim_use" group. > > To unsubscribe from this group and stop receiving emails from it, send an > email to vim_use+u...@googlegroups.com. > > For more options, visit https://groups.google.com/d/optout.
Thank you it works like that: let patfunc = '\(\S\+()\)' let pattime = '\(\d\+\,\d\+\)' let linepat = '^.\{-}'.patfunc.'.*'.pattime.'.\{-}$' let minitestlist = map(copy(totaltimelist)[0:10], 'substitute(v:val, linepat, "\\1 : \\2", "")') -- -- 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 --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.