Thursday, April 5, 2012

Re: match and matchend with a negative lookbehind

On Thursday, April 5, 2012 1:53:13 PM UTC-5, rameo wrote:
> I noted a strange behavior with match and matchend when I use a regex with a negative lookbehind.
>
> p.e.
> text in document:
>
> -2 3-4-5-6-7-8
>
> search string: \([0-9-]\@<!-\)\?\d[0-9]*
> it highights -2 3 4 5 6 7 8 (as I aspected)
>

Highlights when you do what? Are you talking about a simple / search or a syntax highlight or something else?

> but when I check the match and matchend in order to copy the matches, it does include the "-" between 3-4 4-5 5-6 6-7 7-8

match() and matchend() are functions which work on a string, they don't look at buffer text. In what way did you use these on the text? How do you know it includes the "-"? Or are you referring to something other than match() and matchend()?

> Does match and matchend not work with a negative lookbehind?
>

They should. Please give the EXACT command you ran, and tell exactly what you expected, and exactly what happened instead. A script which will reproduce what you see would be best.

--
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: