It depends on what you define as special characters, but try replaceAll(...) :
String result = yourString.replaceAll("[-+.^:,]","");
Please note that the ^ character should not be the first in the list, as you will either need to avoid it, or it will mean "any other than these characters."
One more note: the symbol - must be the first or last in the list, otherwise you would have to avoid it or define a range (for example :-, means "all characters in the range" : to , ).
So, in order to maintain consistency and not depend on the characterβs positioning, you can avoid all the characters that are of particular importance in regular expressions (the following list is not complete, so keep in mind other characters such as ( , { , $ , etc. .):
String result = yourString.replaceAll("[\\-\\+\\.\\^:,]","");
If you want to get rid of all punctuation and characters, try this regular expression: \p{P}\p{S} (keep in mind that in Java strings you would need to avoid backslashes: "\\p{P}\\p{S}" ).
The third way could be something like this if you can pinpoint what should be left on your line:
String result = yourString.replaceAll("[^\\w\\s]","");
This means: replace anything that is not a symbol of the word (az in any case, 0-9 or _) or spaces.
Edit: Please note that there are several other templates that may be useful. However, I cannot explain them all, so look at the regular-expressions.info link.
Here's a less restrictive alternative to the "define allowed characters" approach suggested by Ray:
String result = yourString.replaceAll("[^\\p{L}\\p{Z}]","");
The regular expression matches all that is not a letter in any language, and not a separator (spaces, lines, etc.). Note that you cannot use [\P{L}\P{Z}] (upper case P means no this property), because it means "everything that is not a letter or a space", which almost matches all, as letters are not spaces and vice versa.
Additional Unicode Information
Some Unicode characters seem to cause problems due to various possible ways to encode them (as a single code point or a combination of code points). See regular-expressions.info for more details.