Just using \\s
will account for all of them. And add the +
quantifier on entire character class, to match 1 or more repetition:
Pattern.compile("[~#@*+%\\s]+");
Note that in Java, you need to escape the backslashes. So it's \\s
and not \s
.