Andy Wokula wrote:

> Strange: one can't write a collection with range [X-Y] where Y is the
> character ']'.
> 
> I thought the following should work, but it doesn't:
>      /[@-\]]
> 
> Problem: the range is '@' to '\', and ']' ends the collection; the next ']'
> matches itself.
> 
> (It's surprising that '\]' within '[]' not always means ']' literally!)
> 
> Ok, so the char directly after '-' ends the range?
>      /[@-]]
> 
> No, the collection is '[@-]' followed by ']' which matches itself.  The
> help says it:
> | For '-' you can also make it the first or last character: "[-xyz]",
> | "[^-xyz]" or "[xyz-]".
> 
> Ok, this works:
>      /[@-\\]]
> 
> but it matches the range '@-\' plus the char ']'.

Well, that's correct, ] is right after \.

> A range where \] is the first character works:
>      /[w\]-a]\C
> 
> matches  ] ^ _ ` a w
> 
> 
> Is it a bug that '\' after '-' in a collection is taken literally?

It's indeed stange.

-- 
hundred-and-one symptoms of being an internet addict:
238. You think faxes are old-fashioned.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
You received this message from the "vim_dev" 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

Raspunde prin e-mail lui