Saturday, August 18, 2012

Re: error in regex handling of \n?

On Sat, Aug 18, 2012 at 05:14:40PM EDT, Tim Chase wrote:

[..]

> Sorry I can't claim I remember the post :-)

https://groups.google.com/forum/?fromgroups#!topic/vim_use/zb7KnkxBGSw[1-25]

Made my day, at the time¹..!

> So playing around with this, I've tried multiple cases and must say
> I'm somewhat confused by what happens:

> 1) /e$
> 2) /e[\n]
> 3) /e[\r]
> 4) /e\_[\n]
> 5) /e\_[\r]
> 6) /e[^\n]
> 7) /e[^\r]
> 8) /e\_[^\n]
> 9) /e\_[^\r]

> 1) finds "e" as the last character
> 2) works like #1
> 3) does not find "e" as the last character (but will find one if
> there's a stray ^M after an "e" in the file)
> 4) works like #1
> 5) works like #1, but also finds "e" followed by ^M
> 6) finds all "e" characters, including those at the EOL
> 7) finds all "e" characters except those at the EOL
> 8) same as #7
> 9) finds all "e" characters except those followed by ^M
>
> I guess it's the disparity between #2 (and #4) and #6 (and
> correspondingly, #8) that I find most disconcerting: that the
> negation ("^") of the set doesn't alter it from matching.

The handling of eol's in Vim.. appears to be.. hmm.. a bit 'poetic'..
perhaps :-)

CJ

¹ Even though we never came up with a satisfactory solution to the OP's
question... although the issue was more about eof's that eol's..

--
Oh My God!!! Larry is back!

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

Post a Comment