How to remove the backslash in string using regex in Java?


Answers

You can simply use String.replaceAll()

 String foo = "hai how are\\ you?";
 String bar = foo.replaceAll("\\\\", "");
Question

How to remove the backslash in string using regex in Java?

For example:

hai how are\ you?

I want only:

hai how are you?



Related



Tags

java java   regex