Re: vim and regex construct [^...]
Incoming from Paulo Marcel Coelho Aragão:
> I have just observed that vim handles negated character classes [^...]
> in an apparently odd fashion:
Try it with some normal characters before complicating it with
compound/special/meta chars.
> [\n] matches \n as expected
What does "\n" mean to you? Is it the newline character, or a literal
"n" (sans shell interpretation)?
> [^\n] matches \n ???
> [^^M] doesn't match \n ???
>
> OBS.: I got ^M typing Ctrl-V and <Enter>
>
> The results look contradictory. vim's manual states that [^...] should
> match \n. Therefore, both [^\n] and [^^M] should then match \n.
>
> The manual also says that backslash sequences such as \n cannot be used
> inside [...], but [\n] matches \n.
That should tell you something. "n" == "n"; the "\" is ignored.
> I'm not sure if I'm missing something or this is really a bug worth
> filing. Any opinions ?
--
Any technology distinguishable from magic is insufficiently advanced.
(*) http://www.spots.ab.ca/~keeling Please don't Cc: me.
- -
Reply to: