captainR
        /// <summary>
        /// 通过正则表达式获取字符串中html<input>标签指定value值
        /// </summary>
        /// <param name="FileString">包含html的字符串</param>
        /// <param name="inputName">指定<input>控件的名称</param>
        /// <returns></returns>
        public string GetInput(string FileString, string inputName)
        {
            string inputValue = "";
            MatchCollection matches = Regex.Matches(FileString, @"(?is)<input[^>]+type=""(?:hidden)""[^>]+name=""(?:"+inputName+@")""[^>]+value=""(.+?)""[^>]*>");
            foreach (Match match in matches)
                inputValue += match.Groups[1].Value;

            return inputValue;
        }

 

分类:

技术点:

相关文章:

  • 2021-11-21
  • 2021-10-09
  • 2021-10-09
  • 2021-12-24
  • 2021-10-09
  • 2021-10-09
  • 2021-10-09
  • 2021-11-06
猜你喜欢
  • 2021-10-09
  • 2021-12-31
  • 2021-11-26
  • 2021-10-16
  • 2021-10-09
  • 2021-11-03
  • 2021-08-06
相关资源
相似解决方案