On Thursday, April 19, 2012 5:35:11 AM UTC-5, rameo wrote: > My file - first line: > an 91.010 &System.-sep010- <Nop> > > I want to copy all numbers after -sep > echo match(getline(1), 'sep\zs\d\+\ze-') > gives 23 as output. > All ok. > > but > echo matchend(getline(1), 'sep\zs\d\+\ze-', 23) > gives -1 as output. > Why? > > If I remove "sep" before '\zs' it works. > (echo matchend(getline(1), '\zs\d\+\ze-', 23) > gives 26 as output. > > Does matchend not work with \zs? > How can I resolve this problem?
I haven't looked in detail at your problem, but I wonder if you're running into the same issue as this recent thread: https://groups.google.com/d/topic/vim_use/prE5uPDeETU/discussion In summary, giving a starting position to matchend() without giving a count treats the string as if the beginning of the string is at the starting position. So anything before the starting position cannot be used in the match, unless you provide a count as well. -- 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