初学c#,在论坛中,如果只引用多层引用的最外一层,怎么写正则表达式?例如
test bb
test aa
我只想引用最外面 aa 说的 test aa的留言,这个怎么写?
test bb
test aa
我只想引用最外面 aa 说的 test aa的留言,这个怎么写?
解决方案 »
- 请教C#.net 点击按钮提取MSSQL表数据、指定的内容,发送到指定邮箱??
- 为什么dropdownlist控件设置autopostback属性后鼠标一点整个页面都成空白页?
- datagrid 能否实现分栏?
- .net winform程序如何注册所需组件?
- 求.net下如何获得mssql2008自增列的预定值?
- 关于freetextbox的 、
- 给大家说一个学习的好网站:http://www.863edu.com,这个网站目前已经建好。
- 寻找合作者!
- 急!呵呵~~~
- 哪儿可以下到比较新的.net或者c#教程和例子啊?
- datalist中有td,怎么设置 AlternatingItemStyle 的交替颜色?
- 初学.net,问几个基本问题,请帮我解答下。
string resultStr = Regex.Replace(yourStr, @"((?<head>\[quote\]原帖由\[i\][^\[]*?\[/i\]发表)[\s\S]*\[/quote\](?<content>[^\[\]]*?\[/quote\])|(?<head>\[quote\]原帖由\[i\][^\[]*?\[/i\]发表)[\s\S]*?(?<content>[^\[\]]*?\[/quote\]))", "${head}${content}", RegexOptions.IgnoreCase);
string resultStr = Regex.Replace(yourStr, @"(\[quote\]原帖由\[i\][^\[]*?\[/i\]发表)(\s*?\[quote\]原帖由\[i\][^\[]*?\[/i\]发表[\s\S]*\[/quote\])*?([^\[\]]*?\[/quote\])", "$1$3", RegexOptions.IgnoreCase);用这个吧,这个会好点
http://blog.csdn.net/Eray/archive/2007/04/01/1548507.aspx