Test, validate and match regular expressions
This regular expression strictly validates semantic versioning (SemVer) strings, ensuring they follow the X.Y.Z format. It captures the major, minor, and patch version numbers, while optionally supporting hyphenated pre-release identifiers and plus-signed build metadata. It correctly prevents leading zeros in numeric segments and enforces strict alphanumeric rules for extended attributes.