fork(1) download
  1. import java.util.*;
  2. import java.util.regex.*;
  3.  
  4. class Test
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. String str = "Это текстовая строка (пример (вложенная скобка))";
  9. String regex = "\\s*\\([^()]*\\)";
  10. String tmp = "";
  11. do {
  12. tmp = str;
  13. str = str.replaceAll(regex, "");
  14. } while (!str.equals(tmp));
  15. System.out.println(str);
  16. }
  17. }
Success #stdin #stdout 0.15s 48332KB
stdin
Standard input is empty
stdout
Это текстовая строка