split a string by any symbol
java, regex, split, symbols
Solution
You should use a non word i.e `\W`
`\W` is inverse of `\w`
`\W` is similar to `[^a-zA-Z0-9_]` and so would match any non-word character except `_`
OR
you can simply use `[^a-zA-Z0-9]`
Problem
What is the regex that I should pass with `String.split()` in order to split the string by any symbol? Now, by any symbol I mean any of the following: ``` `~`, `!`, `@`, `#`, ... ``` Basically any non-letter and non-digit printable character.