I have a scenario where i have to remove special characters from a string.
Input String : name=/"xyz =bcd .olm --=myname/"
Output String Must be Like: name=/"xyz bcd olm myname/"
I tried something like below and still not able to come up with the exact regex. Can anyone help me to figure out what i have done wrong?
String inputString = "name=\"xyz =bcd .olm --=myname\""; String regex = "(?<=name=\")[^<]*(?<!/)(\\w+)(?=[^>]*>)"; String outputString = inputString.replaceAll(regex, "$1"); System.out.println(outputString);