Monday, February 19, 2018

Re: pattern of func

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 <nivaemail@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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: