If you have just a pair of brackets ( [] ) in your string, you can use indexOf():
String str = "ABC[ This is the text to be extracted ]";
String result = str.substring(str.indexOf("[") + 1, str.indexOf("]"));
If you have just a pair of brackets ( [] ) in your string, you can use indexOf():
String str = "ABC[ This is the text to be extracted ]";
String result = str.substring(str.indexOf("[") + 1, str.indexOf("]"));