Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
.NET 7.0 (C#)

@"
^(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$
"
gm

Description

.NET version of the Python regex found on https://semver.org/

Submitted by semver.org,Jeff Jacobson - 2 years ago