我的正则表达式:@"<input[^>]*?(name=""(?<name1>\w+)"")*?type=""(hidden|text)""(name=""(?<name2>\w+)"")*?(value=(?<value>\w*))*?[^>]*>"
匹配出来的项:'<input name="sAreaValue" type="hidden" id="sAreaValue" value="1|0" />'
然后我用foreach (Match inputMatch in inputMatchs)
{
GroupCollection inputGroupCollection = inputMatch.Groups;
string inputText = inputMatch.Value;
string value = inputGroupCollection["value"].Value;
string name= inputGroupCollection["name1"].Value;
}为什么name与value没有值呢?请大牛帮忙
匹配出来的项:'<input name="sAreaValue" type="hidden" id="sAreaValue" value="1|0" />'
然后我用foreach (Match inputMatch in inputMatchs)
{
GroupCollection inputGroupCollection = inputMatch.Groups;
string inputText = inputMatch.Value;
string value = inputGroupCollection["value"].Value;
string name= inputGroupCollection["name1"].Value;
}为什么name与value没有值呢?请大牛帮忙
解决方案 »
- SQL查询的菜鸟问题~
- asp.net网站如何调用web服务中的类?
- 想在网页中放一个即现即得的Html编辑框,哪儿可以得到成熟的控件呢?
- sql语句问题
- 有办法把某个组件的默认设置改变吗?
- 请大家提供一下比较好的可下载asp.net源码的网站?
- asp.net两个单击事件互相传值问题
- 我在<FORM元素中加入多个table,每个表都有textbox的元素,可提交按钮不起作用,怎么办?
- Response.Write("<script language = javascript>if(confirm('字号名称重复,是否保存?')) {};</script>")问题?
- 怎樣給DataSet中表t1第gbRow行的字段store_date(即gbRow.store_date)賦空值null?
- asp.net开发工具问题
- 下载问题
html控件要后台获取加runat="server"
<input>控件 当然有啊 在<input>里面加
runat="server" 就能后台调用了!··
<input.*?name="(?<name1>\w+)".*?type="(hidden|text)".*?value="(?<value>\S+)"[^>]*?>
(?i)<input(?=[^>]*?(?:name="(?<name>[^"]*)"))(?=[^>]*?(?:type="(?:hidden|text)"))(?=[^>]*?(?:value="(?<value>[^>]*)"))[^>]*>
Regex reg = new Regex(@"(?is)<input(?>(?:name=""(?<name>[^""]*)""|value=""(?<value>[^""]*)""|type=""(?<type>hidden|text)""|[^>])*)(?(name)|(?!))(?(value)|(?!))(?(type)|(?!))>");
MatchCollection mc = reg.Matches(test);
foreach (Match m in mc)
{
richTextBox2.Text += m.Groups["name"].Value + "\n";
richTextBox2.Text += m.Groups["value"].Value + "\n";
}