On 20/06/10 21:49, ZyX wrote:
While trying to purge comment lines inside a variable, I encountered the
following problem:

     :echo substitute("a\nb", '[\n]', '<NL>', 'g')
     a<NL>b
     :echo substitute("a\nb", '[^\n]', '<!NL>', 'g')
     <!NL><!NL><!NL>

app-editors/vim-7.2.303 (Gentoo amd64),
not fixed in
app-editors/vim-7.2.442 (Gentoo ~amd64)

I also see this (which, from the help paragraph mentioned by John, might be intentional) in Vim 7.3a. However, after some experimenting, I found how not to match a linefeed:

        :echo substitute("a\nb", '[^\d0]', '<!NL>', 'g')
        <!NL>
        <!NL>

see :help NL-used-for-Nul


Best regards,
Tony.
--
Then here's to the City of Boston,
The town of the cries and the groans.
Where the Cabots can't see the Kabotschniks,
And the Lowells won't speak to the Cohns.
                -- Franklin Pierce Adams

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

Raspunde prin e-mail lui