File tree Expand file tree Collapse file tree
src/NuGet.Clients/NuGet.VisualStudio.Common/Telemetry Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88using System . Collections . Generic ;
99using System . Globalization ;
1010using System . Linq ;
11- using System . Text . RegularExpressions ;
11+
1212using System . Threading ;
1313using System . Threading . Tasks ;
1414using NuGet . Common ;
@@ -30,8 +30,6 @@ public sealed class PackageSourceTelemetry : IDisposable
3030
3131 internal const string EventName = "PackageSourceDiagnostics" ;
3232
33- private static readonly Regex s_nonstandardIdCharRegex = new Regex ( @"[^A-Za-z0-9.\-]" , RegexOptions . Compiled ) ;
34-
3533 public enum TelemetryAction
3634 {
3735 Unknown = 0 ,
@@ -216,7 +214,14 @@ internal static void AddNupkgCopiedData(ProtocolDiagnosticNupkgCopiedEvent ncEve
216214
217215 private static bool HasNonstandardCharacters ( string packageId )
218216 {
219- return s_nonstandardIdCharRegex . IsMatch ( packageId ) ;
217+ foreach ( char c in packageId . AsSpan ( ) )
218+ {
219+ if ( ! ( ( c >= 'A' && c <= 'Z' ) || ( c >= 'a' && c <= 'z' ) || ( c >= '0' && c <= '9' ) || c == '.' || c == '-' ) )
220+ {
221+ return true ;
222+ }
223+ }
224+ return false ;
220225 }
221226
222227 public void Dispose ( )
You can’t perform that action at this time.
0 commit comments