public static final String specialChars1= \"\\\\W\\\\S\"; String str2 = str1.replaceAll(specialChars1, \"\").replace(\" \", \"+\"); public static final String speci
@npinti
using "\w" is the same as "\dA-Za-z"
This worked for me:
String result = str.replaceAll("[^\\w ]", "").replaceAll("\\s+", "+");