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.

To see that this infects other constructs using "\_", do this:
  :echo getline(3) =~ '\_[on]'
and you will see that "1" is echoed, which is as expected.

However, if you do
  :echo getline(2) =~ '\_[on]'
you will see that "0" is echoed, which is wrong according to the docs.
Since line two does match an end of line (as we verified in the first
:echo command), this should echo "1".  Also, :h \_[] has the following:

   "With "\_" prepended the collection also includes the end-of-line."

So it should echo "1".

I fully admit that I may have misunderstood something, but if I did, the
docs really need to be changed.

-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