fork(6) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.util.regex.*;
  7.  
  8. /* Name of the class has to be "Main" only if the class is public. */
  9. class Ideone
  10. {
  11. public static void main(String[] args) {
  12. String REC_PATTERN = "^(?>\\w+\\.){3}(.*)$";
  13. Pattern pattern = Pattern.compile(REC_PATTERN);
  14. Matcher m = pattern.matcher("ab.bc.de.ef");
  15. if (m.find())
  16. System.out.println(m.group(1));//output ef
  17. m = pattern.matcher("ab.bc.cd.de.11111");
  18. if (m.find())
  19. System.out.println(m.group(1));//output de.11111
  20. }
  21. }
Success #stdin #stdout 0.04s 4386816KB
stdin
Standard input is empty
stdout
ef
de.11111