Regular expression, get the value of the input specified id or name

        /// <summary>
        /// Get the value of the name of the input
        /// </summary>
        /// <param name="text">文本</param>
        /// <param name="name">id or name parameter</param>
        /// <returns></returns>
        static public string RegInputValue(string text,string name)
        {
            string input = Regex.Match(html, "<input[^>]*(?:id|name)=\""+name+"\"[^>]*>").Value;
            if (input != "")
            {
                return Regex.Match(input, "(?<=value=\")[^\"]*").Value;
            }
            else { return ""; }
        }

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326244093&siteId=291194637