public static final VersionRegEx parseVersion(String versionString) {
        require(versionString != null, "versionString is null");
        final Matcher m = VERSION_PATTERN.matcher(versionString);
        if (!m.matches()) {
            throw new VersionFormatException(versionString);
        }

        final int major = Integer.parseInt(m.group(MAJOR_GROUP));
        final int minor = Integer.parseInt(m.group(MINOR_GROUP));
        final int patch = Integer.parseInt(m.group(PATCH_GROUP));

        checkParams(major, minor, patch);

        final String preRelease;
        if (m.group(PRE_RELEASE_GROUP) != null) {
            preRelease = m.group(PRE_RELEASE_GROUP);
        } else {
            preRelease = "";
        }

        final String buildMD;
        if (m.group(BUILD_MD_GROUP) != null) {
            buildMD = m.group(BUILD_MD_GROUP);
        } else {
            buildMD = "";
        }

        return new VersionRegEx(major, minor, patch, preRelease, buildMD);
    }
public static final VersionRegEx parseVersion ( String versionString ) { require ( versionString != null , "versionString is null" ) ; final Matcher m = VERSION_PATTERN . matcher ( versionString ) ; if ( ! m . matches ( ) ) { throw new VersionFormatException ( versionString ) ; } final int major = Integer . parseInt ( m . group ( MAJOR_GROUP ) ) ; final int minor = Integer . parseInt ( m . group ( MINOR_GROUP ) ) ; final int patch = Integer . parseInt ( m . group ( PATCH_GROUP ) ) ; checkParams ( major , minor , patch ) ; final String preRelease ; if ( m . group ( PRE_RELEASE_GROUP ) != null ) { preRelease = m . group ( PRE_RELEASE_GROUP ) ; } else { preRelease = "" ; } final String buildMD ; if ( m . group ( BUILD_MD_GROUP ) != null ) { buildMD = m . group ( BUILD_MD_GROUP ) ; } else { buildMD = "" ; } return new VersionRegEx ( major , minor , patch , preRelease , buildMD ) ; }
Tries to parse the provided String as a semantic version. If the string does not
conform to the semantic version specification, a {@link VersionFormatException}
will be thrown.

@param versionString The String to parse.
@return The parsed version.
@throws VersionFormatException If the String is no valid version
@throws IllegalArgumentException If {@code versionString} is <code>null</code>.