Nushell can be extended with plugins to have more functionality or types that are not part of standard Nushell.
If you want to work with string values that are actually semantic version values (https://semver.org) you can use the Nushell SemVer plugin.
The plugin must be added to Nushell by using the command plugin add <location of plugin>.
You can check with plugin list command if the plugin is available.
This command also shows commands that the plugin adds to Nushell.
The command into semver can be used to convert string values into a semver type.
The semver type has 5 properties: major, minor, patch, pre and build.
You can use dot notation to get the values for these properties or use the get command.
In the following command a string value is transformed to a semver type: let v = '4.0.2' | into semver.
And with $v.major you can extract the major part of the semver value and it returns 4.
Records with the keys major, minor, patch, pre and build can be transformed to a semver string with the semver from-record command.
And to transform a semver type to a record you can use the command semver into-record.