I'm attempting to make the following replacement in java
@Test public void testReplace(){ String str = "1JU3C_2.27.CBT"; String find = "(\\d*)\\.(\\d*)"; String replace = "$1,$2"; String modified = str.replaceAll(find, replace); System.out.println(modified); assertEquals("1JU3C_2,27.CBT", modified); //fails } However both full stops seem to be getting replaced. I'm looking at replacing only the numeric decimal. (i.e expecting output 1JU3C_2,27.CBT)