Repository: PowerShell/PowerShell
File: src/System.Management.Automation/DscSupport/CimDSCParser.cs (C#)

Code before:
                            keyProp.Values.Count, valueMap.Length, keyword.Keyword);
                        return null;
                    }

                    for (int index = 0; index < valueMap.Length; index++)
                    {
                        string key = keyProp.Values[index];
                        string value = valueMap[index];

                        if (keyProp.ValueMap.ContainsKey(key))
                        {
                            s_tracer.WriteLine(
                                "DSC CreateDynamicKeywordFromClass: same string value '{0}' appears more than once in qualifier 'Values'. Skip the keyword '{1}'.",
                                key, keyword.Keyword);
                            return null;
                        }

                        keyProp.ValueMap.Add(key, value);
                    }
                }

                keyword.Properties.Add(prop.Name, keyProp);
            }

            // update specific keyword with range constraints
            UpdateKnownRestriction(keyword);

            return keyword;
        }

        /// <summary>
        /// Update range restriction for meta configuration keywords
        /// the restrictions are for
        /// ConfigurationModeFrequency: 15-44640
        /// RefreshFrequency: 30-44640.
        /// </summary>
        /// <param name="keyword"></param>
        private static void UpdateKnownRestriction(DynamicKeyword keyword)
        {
            if (
                string.Equals(keyword.ResourceName, "MSFT_DSCMetaConfigurationV2",
                    StringComparison.OrdinalIgnoreCase)
                ||
                string.Equals(keyword.ResourceName, "MSFT_DSCMetaConfiguration",
                    StringComparison.OrdinalIgnoreCase))
            {
                if (keyword.Properties["RefreshFrequencyMins"] != null)
                {
                    keyword.Properties["RefreshFrequencyMins"].Range = new Tuple<int, int>(30, 44640);
                }


Review comment (performance):
If this change is just to get rid of the Regex, then it doesn't make sense. 
If it's about performance, then I suspect that Regex makes better optimizations than this change. And we need measurements to prove that there is a significant increase in parser performance.

Code after:
                        if (keyProp.ValueMap.ContainsKey(key))
                        {
                            s_tracer.WriteLine(
                                "DSC CreateDynamicKeywordFromClass: same string value '{0}' appears more than once in qualifier 'Values'. Skip the keyword '{1}'.",
                                key, keyword.Keyword);
                            return null;
                        }

                        keyProp.ValueMap.Add(key, value);
                    }
                }

                keyword.Properties.Add(prop.Name, keyProp);
            }

            // update specific keyword with range constraints
            UpdateKnownRestriction(keyword);

            return keyword;

            static bool IsMagicProperty(string propertyName) =>
                string.Equals(propertyName, "ResourceId", StringComparison.OrdinalIgnoreCase) ||
                string.Equals(propertyName, "SourceInfo", StringComparison.OrdinalIgnoreCase) ||
                string.Equals(propertyName, "ModuleName", StringComparison.OrdinalIgnoreCase) ||
                string.Equals(propertyName, "ModuleVersion", StringComparison.OrdinalIgnoreCase) ||
                string.Equals(propertyName, "ConfigurationName", StringComparison.OrdinalIgnoreCase);

            static bool IsReservedDynamicKeyword(string keyword) =>
                string.Equals(keyword, "Synchronization", StringComparison.OrdinalIgnoreCase) ||
                string.Equals(keyword, "Certificate", StringComparison.OrdinalIgnoreCase) ||
                string.Equals(keyword, "IIS", StringComparison.OrdinalIgnoreCase) ||
                string.Equals(keyword, "SQL", StringComparison.OrdinalIgnoreCase);

            static bool IsReservedProperty(string name) =>
                string.Equals(name, "Require", StringComparison.OrdinalIgnoreCase) ||
                string.Equals(name, "Trigger", StringComparison.OrdinalIgnoreCase) ||
                string.Equals(name, "Notify", StringComparison.OrdinalIgnoreCase) ||
                string.Equals(name, "Before", StringComparison.OrdinalIgnoreCase) ||
                string.Equals(name, "After", StringComparison.OrdinalIgnoreCase) ||
                string.Equals(name, "Subscribe", StringComparison.OrdinalIgnoreCase);
        }

        /// <summary>
        /// Update range restriction for meta configuration keywords
        /// the restrictions are for
        /// ConfigurationModeFrequency: 15-44640
        /// RefreshFrequency: 30-44640.
        /// </summary>
        /// <param name="keyword"></param>
        private static void UpdateKnownRestriction(DynamicKeyword keyword)
        {