< Back

Test-SemanticVersion

Sat Jan 18, 2020 8:26 pm

NAME Test-SemanticVersion



SYNOPSIS

Tests if a string is a valid Semantic Version.





SYNTAX

Test-SemanticVersion [-InputObject] <Object[]> [<CommonParameters>]





DESCRIPTION

The Test-SemanticVersion function verifies that a supplied string meets the Semantic Version 2.0 specification.



If an invalid Semantic Version string is supplied to Test-SemanticVersion and the Verbose switch is used, the

verbose output stream will include additional details that may help when troubleshooting an invalid version.





PARAMETERS

-InputObject <Object[]>

The Semantic Version string to validate.



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

System.Object



Any object you pipe to this function will be converted to a string and tested for validity.





OUTPUTS

System.Boolean





-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Test-SemanticVersion '1.2.3-alpha.1+build.456'



True



This example shows the result if the provided string is a valid Semantic Version.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Test-SemanticVersion '1.2.3-alpha.01+build.456'



False



This example shows the result if the provided string is not a valid Semantic Version.











RELATED LINKS