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

RE: Pattern questions

Expand Messages
  • Zdenek Sekera
    ... Ooooops, I missed that one. Obvious! Thanks.
    Message 1 of 7 , May 24, 2006
    • 0 Attachment
      > -----Original Message-----
      > From: Charles E Campbell Jr [mailto:drchip@...]
      > Sent: 24 May 2006 15:55
      > To: Zdenek Sekera
      > Cc: vim-dev@...
      > Subject: Re: Pattern questions
      >
      > Zdenek Sekera wrote:
      >
      > >Sorry, I should have been clearer:
      > >
      > >Note the placement of the '+' in my pattern, somewhere
      > >in the middle, there it doesn't cause any problem:
      > >
      > >if (char =~ '\m[;|<>?:!@#$%^&*(){}\\_+-[\]/\"]'
      > > ^
      > > | here
      > >
      > >The erroneous (in my judgement) patterns are (e.g.) are these:
      > >
      > >if (char =~ '\m[;|<>?:!@#$%^&*(){}\\_-[\]/\"+]')
      > >if (char =~ '\m[;|<>?:!@#$%^&*(){}\\_-[\]/\"\+]')
      > >
      > >So the question is why is it OK to have '+' in the middle
      > >and not at the end?
      > >
      > >
      >
      > It has nothing to do with +, and everything to do with - .
      > The "-" is a
      > range character,
      > more commonly seen with something like [a-z] (which stands
      > for all lower
      > case characters).
      > You need to escape the minus sign (ie. \-).

      Ooooops, I missed that one. Obvious! Thanks.

      ---Zdenek
    Your message has been successfully submitted and would be delivered to recipients shortly.