@@ -13,16 +13,22 @@ internal static partial class KernelVerify
1313{
1414#if NET
1515 [ GeneratedRegex ( "^[0-9A-Za-z_]*$" ) ]
16- private static partial Regex AsciiLettersDigitsUnderscoresRegex ( ) ;
16+ private static partial Regex AllowedPluginNameSymbolsRegex ( ) ;
17+
18+ [ GeneratedRegex ( "^[0-9A-Za-z_-]*$" ) ]
19+ private static partial Regex AllowedFunctionNameSymbolsRegex ( ) ;
1720#else
18- private static Regex AsciiLettersDigitsUnderscoresRegex ( ) => s_asciiLettersDigitsUnderscoresRegex ;
19- private static readonly Regex s_asciiLettersDigitsUnderscoresRegex = new ( "^[0-9A-Za-z_]*$" , RegexOptions . Compiled ) ;
21+ private static Regex AllowedPluginNameSymbolsRegex ( ) => s_allowedPluginNameSymbolsRegex ;
22+ private static readonly Regex s_allowedPluginNameSymbolsRegex = new ( "^[0-9A-Za-z_]*$" , RegexOptions . Compiled ) ;
23+
24+ private static Regex AllowedFunctionNameSymbolsRegex ( ) => s_allowedFunctionNameSymbolsRegex ;
25+ private static readonly Regex s_allowedFunctionNameSymbolsRegex = new ( "^[0-9A-Za-z_-]*$" , RegexOptions . Compiled ) ;
2026#endif
2127
2228 internal static void ValidPluginName ( [ NotNull ] string ? pluginName , IReadOnlyKernelPluginCollection ? plugins = null , [ CallerArgumentExpression ( nameof ( pluginName ) ) ] string ? paramName = null )
2329 {
2430 Verify . NotNullOrWhiteSpace ( pluginName ) ;
25- if ( ! AsciiLettersDigitsUnderscoresRegex ( ) . IsMatch ( pluginName ) )
31+ if ( ! AllowedPluginNameSymbolsRegex ( ) . IsMatch ( pluginName ) )
2632 {
2733 Verify . ThrowArgumentInvalidName ( "plugin name" , pluginName , paramName ) ;
2834 }
@@ -36,7 +42,7 @@ internal static void ValidPluginName([NotNull] string? pluginName, IReadOnlyKern
3642 internal static void ValidFunctionName ( [ NotNull ] string ? functionName , [ CallerArgumentExpression ( nameof ( functionName ) ) ] string ? paramName = null )
3743 {
3844 Verify . NotNullOrWhiteSpace ( functionName ) ;
39- if ( ! AsciiLettersDigitsUnderscoresRegex ( ) . IsMatch ( functionName ) )
45+ if ( ! AllowedFunctionNameSymbolsRegex ( ) . IsMatch ( functionName ) )
4046 {
4147 Verify . ThrowArgumentInvalidName ( "function name" , functionName , paramName ) ;
4248 }
0 commit comments