You can use leading match:
"abc".split("[.](?=[^.]*$)")
Here you say: "I want to divide only that point that has no other points after it."
If you want to divide by the last N points, you can generalize this solution to this (even more ugly):
"dfsga.sdgdsb.dsgc.dsgsdfg.dsdg.sdfg.sdf".split("[.](?=([^.]*[.]){0,3}[^.]*$)");
Replace 3 with N-2 .
However, instead, I would write a short static method:
public static String[] splitAtLastDot(String s) { int pos = s.lastIndexOf('.'); if(pos == -1) return new String[] {s}; return new String[] {s.substring(0, pos), s.substring(pos+1)}; }
source share