productList.aspx?m=2&n=3&p=4
求怎么把m、n、p的值用正则表达式的\d去替换,这个写法该怎么写。
m、n、p不一定是一位数,可能是55...
求怎么把m、n、p的值用正则表达式的\d去替换,这个写法该怎么写。
m、n、p不一定是一位数,可能是55...
解决方案 »
- 给出思路即可,给出SQL语句更好
- 三张小图片点击其中一张显示大图片 在同一页面上
- 求一利用asp.net模板生成静态html的例子
- 如何使用AspnetPager啊~~~
- 初学者,想问一下表的设计对否?
- 如何读取硬盘上的一张图片,在图片特定区域内叠加上另外一张图片,生成一张新图片序列化为流输出?
- 如何通过后台在页面中动态添加页面控件(且能交互读值,包括postfile控件并能上传)
- vs2008 在调试时,出现数据绑定混乱问题
- 根据检索得到的数据值,填充DropDownList的问题
- Asp.net源码最近更新列表附截图(11.11-11.30)
- B2C网站中,如何防止并发问题
- 疑难杂症:GridView分页后 DataKeyNames失效
<div class="bl_nt33U"> <div class="blnt_li2"><a href="productList.aspx?mid=58" class="58" level="3" id1="45" id2="47" >儿童床</a></div> <div class="blnt_li2"><a href="productList.aspx?mid=59" class="59" level="3" id1="45" id2="47" >儿童书桌椅</a></div> <div class="blnt_li2"><a href="productList.aspx?mid=60" class="60" level="3" id1="45" id2="47" >儿童衣柜</a></div> <div class="blnt_li2"><a href="productList.aspx?mid=61" class="61" level="3" id1="45" id2="47" >收纳柜</a></div> <div class="blnt_li2"><a href="productList.aspx?mid=62" class="62" level="3" id1="45" id2="47" >其他产品</a></div>
</div>
WebRequest wReq = WebRequest.Create(Url);
WebResponse wResp = wReq.GetResponse();
Stream respStream = wResp.GetResponseStream();
StreamReader reader = new StreamReader(respStream, System.Text.Encoding.GetEncoding("utf-8"));
str = reader.ReadToEnd();
StreamWriter sw = new StreamWriter(HttpContext.Current.Server.MapPath("../../") + furl_html, false, System.Text.Encoding.GetEncoding("utf-8"));
//yourhtml是需要替换的,html是替换成的
string yourhtml = @"(?i)productList\.aspx\?mid=\d+";
string html = "";
html = Regex.Replace(yourhtml, @"(?i)(?<=(['""]?))(\w+)\.aspx(\?[^?'""]+)?(?=\1)",
delegate(Match ma) { return string.Format("{0}.html", ma.Groups[2].Value + ma.Groups[3].Value.Replace("&", "_").Replace("?", "_").Replace("=", "")); });
str = str.Replace(yourhtml, html);
sw.Write(str);
sw.Flush();
sw.Close();兔子督察,帮忙看看,页面内类似yourhtml的内容没有替换掉,是什么原因?
str = str.Replace(yourhtml, html);