Loading ...
Sorry, an error occurred while loading the content.

136179Re: trouble with pattern, character collections

Expand Messages
  • Christian Brabandt
    Feb 17, 2013
      Hi Marc!

      On So, 17 Feb 2013, Marc Weber wrote:

      > > This is allowed so that in a text
      > > which is shown by vim as "A^@A" or "A^MA" the '.' also matches those
      > > control chars carrige return / line feed.
      > This doesn't make sense. If I ask to not match \n I don't want \n to be
      > matched. Its about following the principle of least surprise.

      It depends. Within a text file those control chars can occur and you
      usually want them to be matched by '.' (or [^\n] which is the same).

      > The burden to learn vim specific regex is already high enough for most
      > users.

      I don't see a burden here. In fact I like the vim specific regex, as I
      see it as an enhanced version of BRE (but if you don't like it, use the
      \v modifier).

      > Also try to make me understand why "[^\n]" is supposed to do what it
      > says, but '[^\n]' is not. In which way is either one related to .?

      Because "\n" evals certain special backslash escaped chars within the
      string (:h expr-string) and by definition '.' is the same as [^\n] at
      least since one of the latest patches.

      >
      > > https://groups.google.com/d/topic/vim_dev/DzJ7ZzYlzQI/discussion
      > In any case it should be documented.
      >
      > Also let me know if you think that I missunderstood the docs which I
      > referenced.
      >
      > So this is either an implementation or a documentation bug.
      > I'd like to this to be treated as a implementation bug.
      >
      > Vim should also follow the principle of "least suprprise" - and [^\n] is
      > supposed to not match \n.

      I don't want to change the RE engine so that certain control chars are
      not matched anymore by '.' or [^\n]. This is at least backwards
      incompatible (which I wouldn't have a problem with) and unexpected
      (which I do have a problem with). But in the end, Bram decides.

      Mit freundlichen Grüßen
      Christian
      --
      Deutschland ohne Ausländer ist wie ein Klavier ohne schwarze Tasten.

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

      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Show all 28 messages in this topic