code: private String getPackageVersion(String packageInfoString) {
          // packageInfoString for example - audit-libs-2.7.6-3.el7-x86_64
          try {
              String firstDotString = packageInfoString.substring(0, packageInfoString.indexOf(Constants.DOT));
              int lastIndexOfHyphen = firstDotString.lastIndexOf(Constants.DASH);
              int lastIndexOfDot = packageInfoString.lastIndexOf(Constants.DOT);
              String packVersion = packageInfoString.substring(lastIndexOfHyphen + 1, lastIndexOfDot);
              if (StringUtils.isNotBlank(packVersion)) {
                  return packVersion;
              }
          } catch (Exception e) {
              logger.warn("Failed to create package version : {}", e.getMessage());
          }
          return null;
      }
docs: get rpm package version