Use this:
String replaced = yourString.replaceAll("[^\\w\\xAE\\xA9~. -]", "_");
- In Java,
\w
matches all ASCII letters, numbers and underscore A9
andAE
are the hex codes for copyright and registered trademark
1
solved Java String replace Regular Expression