From 197b6df57d8838ad8151f596604c442930fce2ae Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Wed, 20 Nov 2024 11:35:55 -0500 Subject: [PATCH] fix regex to account for 2 digit or 1 digit named .nupkgs --- src/code/LocalServerApiCalls.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/code/LocalServerApiCalls.cs b/src/code/LocalServerApiCalls.cs index 7f60efa03..e03be71aa 100644 --- a/src/code/LocalServerApiCalls.cs +++ b/src/code/LocalServerApiCalls.cs @@ -260,7 +260,7 @@ private FindResults FindNameHelper(string packageName, string[] tags, bool inclu string actualPkgName = packageName; // this regex pattern matches packageName followed by a version (4 digit or 3 with prerelease word) - string regexPattern = $"{packageName}" + @"\.\d+\.\d+\.\d+(?:[a-zA-Z0-9-.]+|.\d)?.nupkg"; + string regexPattern = $"{packageName}" + @"(\.\d+){1,3}(?:[a-zA-Z0-9-.]+|.\d)?\.nupkg"; Regex rx = new Regex(regexPattern, RegexOptions.Compiled | RegexOptions.IgnoreCase); _cmdletPassedIn.WriteDebug($"package file name pattern to be searched for is: {regexPattern}");