Class SemanticVersionParser

java.lang.Object
com.norconex.commons.lang.version.SemanticVersionParser

public class SemanticVersionParser extends Object

Semantic version string parser. Default parser settings conform to https://semver.org/ specifications. Use available builder options for more lenient parsing.

Max version length

The maximum string length supported by this parser is 255 characters. Longer strings will throw a SemanticVersionParserException except when SemanticVersionParser.SemanticVersionParserBuilder.ignoreLeadingCharacters(boolean) is true. In such case, it will try parsing longer strings, but will only consider the last 255 characters.

Since:
3.0.0
  • Field Details

    • STRICT

      public static final SemanticVersionParser STRICT
      Default parser settings, using strict adherence to SemVer specifications.
    • LENIENT

      public static final SemanticVersionParser LENIENT
      A relaxed parser with support for optional minor and patch numbers, ignoring leading characters, and ignoring the following suffix strings: .jar, .zip, .exe, .gz, .tgz, .tar, and .tar.gz,
    • TAG

      public static final SemanticVersionParser TAG
      Same as STRICT except for ignoring non-numeric leading characters before the version (e.g., v1.2.3).
  • Method Details