'Regex to recognise valid NuGet package filenames
Some NuGet packages have filenames that look valid but are not. Perhaps the versioning does not comply with semver or the name of the package confuses NuGet's parser when it tries to extract the version number from the filename. These packages can be pushed to a NuGet repo without any issue but the NuGet CLI will then start having issues listing that repo's packages.
Can someone please help me write a regex in C# that differentiates good names from bad names?
https://docs.microsoft.com/en-us/nuget/concepts/package-versioning
I have found the code on the NuGet client that does this parsing but it's not doing this with a regex for performance reasons. I need a regex in order to validate package filenames before they get pushed:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|