I've found a good reference that helps to understand regular expression with GREP.
Have a look at this site http://www.robelle.com/smugbook/regexpr.html
Yann
Pattern pattern = Pattern.compile("^([a-zA-Z0-9]*)_(\\d*)?_?(.*)-\\d*_.*$");
Matcher m = pattern.matcher(resourceFile.getName());
if (m.find()) {
String destinationNickname = m.group(1);
String jobnumber = m.group(2);
String originalFileName = m.group(3);
}