java - Split string at hyphen characters too -


the line below splits string on (.), (,), (:) , newline (\n) characters.

string[] textphrases = text.split("[.,:\\n]"); 

i need split on hyphen characters too, not work:

string[] textphrases = text.split("[.,:/-/\\n]"); 

what missing or doing wrong? thank you.

this regex. hyphen has special meaning inside character class. need place hyphen first or last item in class:

[-.,:\n] 

Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -