[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

vim and regex construct [^...]



I have just observed that vim handles negated character classes [^...]
in an apparently odd fashion: 

[\n]   matches \n	    as expected
[^\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.

I'm not sure if I'm missing something or this is really a bug worth
filing. Any opinions ?

Thanks
Paulo



Reply to: