int startIndex = str.indexOf("("); int endIndex = str.indexOf(")"); String replacement = "I AM JUST A REPLACEMENT"; String toBeReplaced = str.substring(startIndex + 1, endIndex); System.out.println(str.replace(toBeReplaced, replacement));