string s = "<FORM id=logInForm name=logInForm action=chk_rule.php method=post><INPUT type=hidden value=nf3a5776z23th8npzppq54z1j0d9z032 name=uid>

</FORM>";

Regex re = new Regex(@"\s+value=([^\s>]+)");

Match m = re.Match(s);
if (m.Success)
Console.WriteLine(m.Groups[1].Value);


++++++++++++++++++++++++++++++++++++++++++++++
起始,结束字符都是固定的,即不是带正则元字符的,其实用IndexOf也许更好些

string Start = "...";
string End = "...";


string s = "............";

int i = s.IndexOf(Start);
if (i >=0)
{
  int j= s.IndexOf(End, i+Start.Length);
  if (j >0)
  {
string Result = s.Substring(i+Start.Length, j-i-Start.Length);
  }
}


//********************* 正则判断是否存在某个字符串。

 //if (System.Text.RegularExpressions.Regex.IsMatch(html, "&uid="))
                            //{
                            //    return true;
                            //}

相关文章:

  • 2021-12-22
  • 2021-08-09
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
  • 2021-10-30
  • 2021-10-08
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-30
相关资源
相似解决方案