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?
because the 23 that was returned from match() is the position of the
first digit, not the position of 'sep'. Thus you try to find
'sep\zs\d\+\ze-' in a string that for matchend() seems to consist only
of
010- <Nop>
Regards,
Jürgen
--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)
--
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
No comments:
Post a Comment