I have the following String (This format for the string is generic)
abc_2012-10-18-05-37-23_prasad_hv_Complete
I want to extract only
You say
This format for the string is generic.
Then concatenate the elements with indexes 2 and 3 after splitting:
String str = "abc_2012-10-18-05-37-23_prasad_hv_Complete";
String[] parts = str.split("_");
String extractedResult = "";
if(parts.length > 3)
extractedResult = parts[2] + "_" + parts[3]; // prasad_hv is captured here.