hardillb’s avatarhardillb’s Twitter Archive—№ 18,428

  1. Having "fun" trying to find a regex to validate semVer strings and combine it with one for npm package names
    1. …in reply to @hardillb
      I forgot I also need to allow @scope/*
      1. …in reply to @hardillb
        @scope This nearly works /^((@[a-z0-9-~][a-z0-9-._~]*\/)?([a-z0-9-~][a-z0-9-._~]*|\*))(@((0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?))?$/i