code: public static Version parseVersion(String versionString) {
          final Matcher versionMatcher = VERSION_PATTERN.matcher(versionString);
          if (!versionMatcher.matches()) {
              return null;
          }
  
          final int major = Integer.parseInt(versionMatcher.group(1));
          final int minor = Integer.parseInt(versionMatcher.group(2));
          final int patch = Integer.parseInt(versionMatcher.group(3));
          final String local = versionMatcher.group(4);
          if (local != null) {
              return new SimpleVersion(major, minor, patch, Integer.valueOf(local));
          }
  
          return new SimpleVersion(major, minor, patch);
      }
docs: Parse a version string into a Version object, if the string doesn't match the pattern null is
  returned.
  
  <p>The regular expression used in parsing is: ^(\d+)\.(\d+)\.(\d+)(?:\.(\d+))?(?:[\.-].*)?$
  
  <p>Examples that match correctly:
  
  <ul>
  <li>4.0.5
  <li>4.0.5.123123
  <li>4.0.5-SNAPSHOT
  <ul>
  Examples do NOT match correctly:
  <ul>
  <li>4.0
  <li>4.0.5_123123
  <ul>