Repository: PowerShell/PowerShell
File: src/System.Management.Automation/engine/CommandCompletion/CompletionHelpers.cs (C#)

Code before:
                .Get(wordToComplete + "*", WildcardOptions.IgnoreCase)
                .IsMatch(value);

        /// <summary>
        /// Determines if the given value matches the specified word using either a literal or wildcard escape strategy.
        /// </summary>
        /// <returns>
        /// <c>true</c> if the value matches either the literal normalized word or the wildcard pattern with escaping; 
        /// otherwise, <c>false</c>.
        /// </returns>
        /// <remarks>
        /// This strategy first attempts a literal prefix match and, if unsuccessful, escapes the word to complete to 
        /// handle any problematic wildcard characters before performing a wildcard match.
        /// </remarks>
        internal static readonly MatchStrategy WildcardPatternEscapeMatch = (value, wordToComplete)
            => LiteralMatch(value, wordToComplete) ||
               WildcardPatternMatch(value, WildcardPattern.Escape(wordToComplete));

        /// <summary>
        /// Determines if the given value matches the specified word using either a literal or wildcard match strategy.
        /// </summary>
        /// <returns>
        /// <c>true</c> if the value matches either the literal normalized word or the wildcard pattern; otherwise, <c>false</c>.
        /// </returns>
        /// <remarks>
        /// This strategy attempts a literal match first and, if unsuccessful, evaluates the word against a wildcard pattern.
        /// </remarks>
        internal static readonly MatchStrategy DefaultMatch = (value, wordToComplete)
            => LiteralMatch(value, wordToComplete) ||
               WildcardPatternMatch(value, wordToComplete);

        /// <summary>
        /// Removes wrapping quotes from a string and returns the quote used, if present.
        /// </summary>
        /// <param name="wordToComplete">
        /// The string to process, potentially surrounded by single or double quotes.
        /// This parameter is updated in-place to exclude the removed quotes.
        /// </param>
        /// <returns>
        /// The type of quote detected (single or double), or an empty string if no quote is found.
        /// </returns>
        /// <remarks>
        /// This method checks for single or double quotes at the start and end of the string.
        /// If wrapping quotes are detected and match, both are removed; otherwise, only the front quote is removed.
        /// The string is updated in-place, and only matching front-and-back quotes are stripped.
        /// If no quotes are detected or the input is empty, the original string remains unchanged.
        /// </remarks>
        internal static string HandleDoubleAndSingleQuote(ref string wordToComplete)
        {
            if (string.IsNullOrEmpty(wordToComplete))
            {

Review comment (performance):
```suggestion
        /// This strategy attempts a literal match first for performance and, if unsuccessful, evaluates the word against a wildcard pattern.
```

Code after:
                .Get(wordToComplete + "*", WildcardOptions.IgnoreCase)
                .IsMatch(value);

        /// <summary>
        /// Determines if the given value matches the specified word considering wildcard characters literally.
        /// </summary>
        /// <returns>
        /// <c>true</c> if the value matches either the literal normalized word or the wildcard pattern with escaping; 
        /// otherwise, <c>false</c>.
        /// </returns>
        /// <remarks>
        /// This strategy first attempts a literal prefix match for performance and, if unsuccessful, escapes the word to complete to 
        /// handle any problematic wildcard characters before performing a wildcard match.
        /// </remarks>
        internal static readonly MatchStrategy WildcardPatternEscapeMatch = (value, wordToComplete)
            => LiteralMatchOrdinalIgnoreCase(value, wordToComplete) ||
               WildcardPatternMatchIgnoreCase(value, WildcardPattern.Escape(wordToComplete));

        /// <summary>
        /// Determines if the given value matches the specified word taking into account wildcard characters.
        /// </summary>
        /// <returns>
        /// <c>true</c> if the value matches either the literal normalized word or the wildcard pattern; otherwise, <c>false</c>.
        /// </returns>
        /// <remarks>
        /// This strategy attempts a literal match first for performance and, if unsuccessful, evaluates the word against a wildcard pattern.
        /// </remarks>
        internal static readonly MatchStrategy DefaultMatch = (value, wordToComplete)
            => LiteralMatchOrdinalIgnoreCase(value, wordToComplete) ||
               WildcardPatternMatchIgnoreCase(value, wordToComplete);

        /// <summary>
        /// Removes wrapping quotes from a string and returns the quote used, if present.
        /// </summary>
        /// <param name="wordToComplete">
        /// The string to process, potentially surrounded by single or double quotes.
        /// This parameter is updated in-place to exclude the removed quotes.
        /// </param>
        /// <returns>
        /// The type of quote detected (single or double), or an empty string if no quote is found.
        /// </returns>
        /// <remarks>
        /// This method checks for single or double quotes at the start and end of the string.
        /// If wrapping quotes are detected and match, both are removed; otherwise, only the front quote is removed.
        /// The string is updated in-place, and only matching front-and-back quotes are stripped.
        /// If no quotes are detected or the input is empty, the original string remains unchanged.
        /// </remarks>
        internal static string HandleDoubleAndSingleQuote(ref string wordToComplete)
        {
            if (string.IsNullOrEmpty(wordToComplete))
            {