Build, test, and debug regular expressions
This regular expression strictly validates semantic versioning (SemVer) strings according to the official 2.0.0 specification. It captures the major, minor, and patch numeric components, while also supporting optional hyphen-separated prerelease identifiers and plus-separated buildmetadata tags. It ensures that numeric segments do not contain leading zeros and requires alphanumeric identifiers to follow specific formatting rules. It is commonly used in package managers, release automation scripts, and API versioning to ensure correctly formatted version numbers.