fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.util.regex.*;
  5.  
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. String str = "text1${text2${text3}text4}text5";
  11. Pattern p = Pattern.compile("\\$\\{([^{}]*)}");
  12. Matcher m = p.matcher(str);
  13. while (m.find()) {
  14. System.out.println(m.group(1));
  15. }
  16. }
  17. }
Success #stdin #stdout 0.05s 712192KB
stdin
Standard input is empty
stdout
text3