How to split a string by multiple dots or Horizontal Ellipsis

I am facing problems when trying to split a String by “…”

    String text ="Here…It is safer.";

I tried:

String [] output = text.split("[//...]");
String [] output = text.split("//.");

and many others, but I haven’t found the solution yet.

I know that the question is very simple, but I will be happy If somebody can explain how should I make it work.

Regex for matching three dots is //.{3} or //.//.//. or [.][.][.] or //Q…//E.

Both [//…] and //. match a single dot, because repeated characters inside a character class are treated as a single character.

Horizontal ellipsis is a different character. It is not a metacharacter in regex language, so it can be matched directly with no escaping:

String [] output = text.split("…");

Regex for multiple dots would be:


Java would require something like this if I remember correct:


Edit: Just noticed you asked for triple dot only. Since there is a correct answer already I’m going to leave this here just in case.