### Question:
DateFromString { public static Date getDateUsingRegExp(String dateString, String matchPattern, String substitutionPattern) { String dateFormatString = "yyyy-MM-dd'T'HH:mm"; return getDateUsingRegExpAndDateFormat(dateString, matchPattern, substitutionPattern, dateFormatString); }  static Date getDateUsingSimpleDateFormat(String dateString, String dateFormatString); static Date getDateUsingDemarkatedCount(String dateString, String dateFormatString, char demark); static Date getDateUsingDemarkatedMatch(String dateString, String dateFormatString, char demark); static Date getDateUsingCompleteDateFormat(String dateString, String dateFormatString); static Date getDateUsingCompleteDateFormatWithOffset(String dateString, String dateFormatString,
      int startIndex); static Date getDateUsingRegExp(String dateString, String matchPattern, String substitutionPattern); static Date getDateUsingRegExpAndDateFormat(String dateString, String matchPattern, String substitutionPattern,
      String dateFormatString);  }### Answer:
@Test public void testGetDateUsingRegExp() { String matchPattern = ".*([0-9]{4})([0-9]{2})([0-9]{2})_([0-9]{2})([0-9]{2}).*grib"; String substitutionPattern = "$1-$2-$3T$4:$5"; Date date = DateFromString.getDateUsingRegExp(fileName, matchPattern, substitutionPattern); Assert.assertEquals("Calculated date <" + date.toString() + " [" + date.getTime() + "]> not as expected <" + dateAsISOString + "[" + dateAsLong + "]>." + "\nUsing fileName <" + fileName + ">, matchPattern <" + matchPattern + ">, and substitutionPattern <" + substitutionPattern + ">", date.getTime(), dateAsLong); }