Friday, August 17, 2012

Re: error in regex handling of \n?

On Friday, August 17, 2012 1:01:53 PM UTC-5, Tim Chase wrote:
> On 08/17/12 12:51, Chris Jones wrote:
>
> > On Fri, Aug 17, 2012 at 11:09:21AM EDT, Tim Chase wrote:
>
> >> /r[^\n]
>
> >> /r\_[^\n]
>
> >>
>
> >> to no avail.
>
> >
>
> > /r[^\r]
>
>
>
> Well, bust my buttons. So "\n" is a newline on the search side, and
>
> "\r" is a newline on the replacement side, but it's also a newline
>
> on the search side if it's in a negated character class, but not in
>
> a non-negated character class of a search?
>

Or (more likely in my mind), [^\r] means "not the literal ^M character".

/r[^\r] in this text only matches the "ra" line:

r^M
r
ra
r^Ma

It "works" for the line with just "r" because that r is, in fact, not followed by a \r character.

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