This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
The first parameter to replaceAll() is a regular expression and in regular expressions the characters '(' ,')' and '*' are meta characters that have a special meaning. I suspect you just need to use the replace() method which takes the first argument literally.
Retired horse trader.
Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
Swastik Dey wrote:I have the following code snippet to replace a string, but it's not working.
As mentioned above, String.replaceAll treats the first argument string as regular expression.
If you want to replace ALL without regular expression, try with \Q..\E sequence.
http://www.regular-expressions.info/characters.html#qe
Raymond Tong wrote:
If you want to replace ALL without regular expression, try with \Q..\E sequence.
That is absolutely true and I considered posting this information but the OP seems not to understand even the minimum about regular expressions since he obviously did not recognise the most fundamental meta characters. The conclusion is that the OP just wants to replace literally and then what is the point of going to the trouble of parsing a regular expression when the replace() method will achieve the same result?