If you are sure there are no more occurences of ..
in your text, and your text is a String
then this might be the easiest solution:
String result = text.substring(text.indexOf("..") + 2, text.lastIndexOf("..") - 2);
If there are more occurences of ..
, you could use regular expressions or a Scanner. Here's a solution using regular expressions.
Pattern pattern = Pattern.compile(".*?\\.\\.(.*?)\\.\\.", Pattern.DOTALL);
Matcher matcher = pattern.matcher(text);
while (matcher.find()) {
String result = matcher.group(1);
// ...
}
This code assumes that the first ..
starts a paragraph, the second ..
ends a paragraph. The following characters are to be ignored until the next occurence of ..
.