/
^ # Start of version string
\s* # Ignore leading whitespace
(?:v\.?)? # Optional "v" or "v." before the version
(?<major>\d+) \. (?<minor>\d+) \. (?<patch>\d+) # MAJOR.MINOR.PATCH
(?:- # Pre-release versions start with '-'
(?<pre> # Capture the pre-release identifier(s)
(?: # The PR rules are annoyingly tight
[0-9A-Za-z-] # No leading `0`, but a `0` on its own is fine
| # More than one character...
[1-9A-Za-z-][0-9A-Za-z-]* # ...means no leading zero
) # That's