regex - Replace all {any characters} in Java string -


thanks can me. need remove records in string starting "{" , ending "}" including brackets.

i tried this:

value.replaceall("{.}","") 

at moment, looking braces 1 character inside except have not escaped braces, have special meaning in regexes. should be: \\{.*\\} (the * for: match many characters possible).

but if have input like: {ab}cd{ef} , want cd, need use non-greedy operator or match whole string.

in case, can try this:

value = value.replaceall("\\{.*?\\}",""); 

Comments