code: public Integer extractIntFromUsingGroup(String value, String regEx, int groupIndex) {
          Integer result = null;
          if (value != null) {
              Matcher matcher = getMatcher(regEx, value);
              if (matcher.matches()) {
                  String intStr = matcher.group(groupIndex);
                  result = convertToInt(intStr);
              }
          }
          return result;
      }
docs: Extracts a whole number for a string using a regular expression.
  @param value input string.
  @param regEx regular expression to match against value.
  @param groupIndex index of group in regular expression containing the number.
  @return extracted number.