I have this task where in the message has nested curly brackets.My motive is to get to remove only the inner most curly brackets and the rest of the message stays the same.A sample of The string message is as follows :
enter code here Input : {4:{CLIENT ACCOUNT} :-}
Output: {4: CLIENT ACCOUNT :-}
So Basically we need to ensure to remove the innermost curly brackets,rest of the content staying the same.How to go about it ?
I was able to remove one level of braces using the following pseudo code :
enter code here
String str ="{CLIENT ACCOUNT}";
String regex = "(\\{|\\})";
str = str.replaceAll(regex, "");
System.out.println("Formatted String is--"+str);
but i am stuck as to what to use the regex for ignoring the first level of curly brackets.any help will be highly appreciated.