[Solved] Java String replace Regular Expression

[ad_1]

Use this:

String replaced = yourString.replaceAll("[^\\w\\xAE\\xA9~. -]", "_");
  • In Java, \w matches all ASCII letters, numbers and underscore
  • A9 and AE are the hex codes for copyright and registered trademark

1

[ad_2]

solved Java String replace Regular Expression