先贴我的html代码 <input name="txtPrice_212" type="text" />
<input name="txtPrice_213" type="text" />
<input name="txtPrice_214" type="text" />
<input name="test" type="text" />
我post提交后,到后台,想获取以"txtPrice_"开头的表单,请问我后台代码要怎么写。
我知道可以通过正则表达式来获取,不过我不懂正则表达式.请教各位大大

解决方案 »

  1.   

    "<input[^>]+?name=\"txtPrice_[^>]+>"
      

  2.   

    不懂
    后台可以得到的不是前台的参数或session么?怎么会有前台把网页源码提交给服务器的?如果单纯文本中获取,(?is)<input[^>]+?name="txtPrice_[^>]+>可以得到你要的<input标签
      

  3.   

    大哥,这个是写在后台吗?
    我是想通过Request.Form[".."]这种类型的获取
      

  4.   

    但是我那些html是动态生成的。
      

  5.   

    Java的话,String paramName = ... // 得到一个参数名
    Pattern p = Pattern.compile("^txtPrice_.*$");
    if(p.matcher(paramName).matches()) {
      // ...
    }
      

  6.   

    Pattern p = Pattern.compile("^txtPrice_.*$");
    改为
    Pattern p = Pattern.compile("^txtPrice_\\w*$");
    规范些
      

  7.   

    后台取值使用request.Form
    for(int i = 0;i<Request.Form.Count;i++)Response.Write("<li>" + Request.Form.Keys[i].ToString() + " = " + Request.Form[i].ToString());