Friday, August 17, 2012

error in regex handling of \n?

Hi,

this is possibly me not being regex proficient enough, but here goes: When I search for patterns with 'not newline' at the end, for instance, "/&[^\n]", the "[ ]" part seems to match "/&\n". I have realized that using simply "/&." is a simpler and better regex, but nevertheless - why doesn't my first suggestion work as expected?

Furthermore, I notice (using the hlsearch option) that the pattern [\n] matches _everything_. This must surely be a bug?

The same applies to these two vim versions:
$ mvim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Sep 18 2011 16:00:17)
MacOS X (unix) version
Included patches: 1-315
Compiled by Bjorn Winckler <bjorn.winckler@gmail.com>

$ vim
paulanto@courant:/tmp/paulanto $ vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jul 2 2012 18:54:34)
MacOS X (unix) version
Included patches: 1-69
Compiled by paulanto@courant.local

Operating system: Mac OS X 10.7.4

Cheers
Paul

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