I tried this but it doesn't work :
[^\s-]
Any Ideas?
I tried this but it doesn't work :
[^\s-]
Any Ideas?
Perhaps the - is being confused for a range operator (as in [a-z]). Try putting it first.
[^-\s]
[^\s-]
should work and so will
[^-\s]
[] : The char class^ : Inside the char class ^ is the
negator when it appears in the beginning.\s : short for a white space- : a literal hyphen. A hyphen is a
meta char inside a char class but not
when it appears in the beginning or
at the end.Which programming language are you using? May be you just need to escape the backslash like "[^\\s-]"