Ejemplo n.º 1
0
        private void ParseTextQuery()
        {
            ParametersName.Clear();

            Regex regex = new Regex(@"""+[^""]+"""); // "+[^"]+"

            if (QueryText.StartsWith("Выбрать", true, null))
            {
                QueryText = $"\"{QueryText}\"";
            }

            if (regex.IsMatch(QueryText))
            {
                string textQuery = string.Empty;
                foreach (Match match in regex.Matches(QueryText))
                {
                    textQuery += match.Value;
                }

                regex = new Regex("&+[A-zА-я0-9]*");

                if (regex.IsMatch(textQuery))
                {
                    foreach (Match item in regex.Matches(textQuery))
                    {
                        string nameParameter = item.Value.Substring(1);
                        if (!ParametersName.Contains(nameParameter))
                        {
                            ParametersName.Add(nameParameter);
                        }
                    }
                }
            }
        }