java - How to create a character class of the following set -


+ - * / % < > = ! & ^ | ? : 

i've tried:

[+-*/%<>=!&^|?:] 

but think of them need scaped. how can tell ones?

you'll need escape - otherwise it'd interpreted character range between + , *, isn't valid:

[+\-*/%<>=!&^|?:] 

the other metacharacters, far know, taken literally in character class.


Comments