On Sun, Jun 14, 2015 at 12:09 AM, James McCoy <[email protected]> wrote:

> On Sat, Jun 13, 2015 at 11:55:12PM -0400, Manuel Ortega wrote:
> > Vim 7.4.738 here, Mac OSX 10.10.3. (Not MacVim, although the below is
> > reproducible there too).
> >
> > Either the "\_" regexp construct is broken, or the docs are badly
> > misleading.  I don't know which.  The following problem seems
> > independent of &re=1 or &re=2.  I always use &re=1.
> >
> > Open a new, empty vim buffer.  Hit
> >    i<CR><CR>noon
> > which should make the first two lines empty and the third contain
> > 'noon'.
> >
> > Now do
> >   :echo getline(2) =~ '\_$'
> > You will observe that "1" is echoed, which is correct behavior.
> >
> > Next do
> >   :echo getline(2) =~ '\_.'
> > and you will observe that "0" is echoed.
> >
> > This contradicts the docs.  The docs say that \_$ matches an end of
> > line, and \_. will match either an end of line or any character.  If the
> > latter is true, there should not have been a "0" echoed.
>
> The documentation is correct in the context of searching the buffer.  In
> the context of pattern matching against an, in the case of getline(2),
> empty string, then \_$ correctly matches the end of the string while \_.
> doesn't match because there is neither a character or a newline.


The docs don't seem to distinguish these "contexts" (unless I missed
something).  It would be nice if they did.

-Manny

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui