首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

c# 正则表达式,该如何解决

2013-09-28 
c# 正则表达式input typehidden nameformhash value59c61016 / 我要取59c61016 怎么写 在winfo

c# 正则表达式
<input type="hidden" name="formhash" value="59c61016" /> 我要取59c61016 怎么写 在winform中 正则表达式 winform c#
[解决办法]

string str=@"<input type=""hidden"" name=""formhash"" value=""59c61016"" /> ";
                str = Regex.Match(str, @"(?i)<input[^>]*?name=(['""]?)formhash\1[^>]*?value=(['""]?)([^'""]*?)\2[^>]*?>").Groups[3].Value;//59c61016

[解决办法]
直接这么写:
(?<=<input[^>]*name="formhash"[^>]*value=")[^"]+(?=")
其中双引号的转义自己处理
[解决办法]
看错了,不是纯数字用这个.
string  P="<input type="hidden" name="formhash" value="([^"]*)""); 

热点排行