On 08/04/10 18:36, Bee wrote:
[^\s]\+ matches everything except "\" and "s"
Might make sense if "\s" was not special (?magic)
I would think it should match all non-whitespace

I have not found any reference that "\s" cannot be used within [...]
similar to "\t"

Is this a bug? or feature?

I'm not sure it's either a bug or a feature, but it is documented. In my help, if I issue

  :he /\]

and read the 2nd bullet-point (there's no nice help-tag to drop you right to it) you'll find:

"""
- The following translations are accepted [in a square-bracket character-class] when the 'l' flag is not included in 'cpoptions' {not in Vi}:
...
   \t   <tab>
"""

You'll see the other allowed items there. Note that they are all *characters*, not *character-classes*. You may also want to make note of the difference described at ":help cpo-l". The "\s" is a character-class; and to get the inverse, use "\S" (capital-S). It does make it a bit of a pain if you want to find something like "stuff that is neither whitespace nor punctuation", but then you can use the POSIX-style character-classes:

  /[^[:space:][:punct:]]\+

(There's a subtle difference between "[:blank:]" and "[:space:]" depending on whether you want whitespace characters other than tab/space...read up at ":help [:blank:]" and around that section)

Hope this helps...

-tim




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

Reply via email to