Tangentially related, but mentioning to hopefully save someone time: if you ever find yourself wanting to check if a version string is semver or not, before inventing your own, there is an official regex that’s provided.
I just discovered this yesterday and I’m glad I didn’t have to come up with this: