首页 新闻 会员 周边 捐助

c#使用正则提取内容

0
悬赏园豆:10 [已解决问题] 解决于 2008-06-05 02:09
<P>这个是&lt;%=DB.shownewsfunction(2,0,1,14,0,20,200,100,0,1,0,1401,0,0,0,0,0,0)%&gt;这个是&lt;%=DB.shownewsfunction1(2,0,1,14,0,20,200,100,0,1,0,1401,0,0,0,0,0,0)%&gt;</P> <P>我要提取上面代码中&lt;%=DB.shownewsfunction(2,0,1,14,0,20,200,100,0,1,0,1401,0,0,0,0,0,0)%&gt;,2,0,1,14,0,20,200,100,0,1,0,1401,0,0,0,0,0,0以及shownewsfunction这几个内容,请问怎么做</P> <P>PS:可能内容中有&lt;%=DB.shownewsfunction1(2,0,1,14,0,20,200,100,0,1,0,1401,0,0,0,0,0,0)%&gt;,&lt;%=DB.shownewsfunction2(2,0,1,14,0,20,200,100,0,1,0,1401,0,0,0,0,0,0)%&gt;等不同的函数,我都要提取</P>
生活无限的主页 生活无限 | 初学一级 | 园豆:6
提问于:2008-05-28 15:04
< >
分享
最佳答案
0
[code] string txt = "<%=DB.shownewsfunction1(2,0,1,14,0,20,200,100,0,1,0,1401,0,0,0,0,0,0)%>"; Regex regex = new Regex("<%=DB[.](?<fun>[\\w]+)\\((?<parms>[^\\)]+)\\)%>"); Match match = regex.Match(txt); if (match.Success) { Response.Write(match.Groups["fun"].Value); Response.Write(match.Groups["parms"].Value); } [/code]
玉开 | 大侠五级 |园豆:8822 | 2008-05-28 15:30
其他回答(2)
0
拜托,看一眼MSDN好不`~?
沙加 | 园豆:3680 (老鸟四级) | 2008-05-28 16:20
0
哈哈!
伽马科技.攻城师 | 园豆:1303 (小虾三级) | 2008-05-29 15:24
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册