I have a string \"\\\\u003c\", which belongs to UTF-8 charset. I am unable to decode it to unicode because of the presence of double backslashes. How do i get \"\\u003c\" fr
Another option, capture one of the two slashes and replace both slashes with the captured group:
public static void main(String args[]) { String str = "C:\\\\"; str= str.replaceAll("(\\\\)\\\\", "$1"); System.out.println(str); }