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
This will work even when you have many number of underscore characters in the string you wanted.
str.substring(str.indexOf("_", str.indexOf("_") + 1) + 1, str.lastIndexOf("_"));