This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Originally posted by Celinio Fernandes: I actually need 4 backslahes !
The reason that you need four backslashes is because the backslash has special meaning in a regex replacement string. And as mentioned, the backslash has special mean in a Java string literal.
So, to have one literal backslash, you need to escape the backslash with a backslash to turn off the regex replacement string meaning. Then you must escape the two backslashes, each with a backslash to turn off the special meaning in the Java string literal..... hance, 4 backslashes.