Categories
How to remove all characters that are outside {}?
Let's say I have a string ab{cde}fg, how to remove the characters that are outside the brackets, what would be {cde}. Thank you!
Answer the question
In order to leave comments, you need to log in
str.replaceAll(".*(\\{.*?\\}).*","\\1");
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question