62,271
社区成员
发帖
与我相关
我的任务
分享string test = "<img alt=\"刘继在比赛中\" src=\"http://i1.sinaimg.cn/ty/2010/0929/2010929101036.jpg\" style=\"border:px solid #000000\" title=\"刘继在比赛中\" />";
Regex reg = new Regex(@"(?is)(?<=<img[^>]*?src=(['""]?))[^'""\s>]*(?=/[^'""\s>/]+\1[^>]*>)");
string result = reg.Replace(test, "本项目的一个文件的路径");
richTextBox2.Text = result;Regex reg = new Regex(@"(?is)<a[^>]*>(.*?)</a>");
string result = reg.Replace(yourStr, "$1");
richTextBox2.Text = result;<img alt="刘继在比赛中" src="http://i1.sinaimg.cn/ty/2010/0929/2010929101036.jpg" style="border:px solid #000000" title="刘继在比赛中" /><img alt="刘继在比赛中" src="本项目的一个文件的路径/2010929101036.jpg" style="border:px solid #000000" title="刘继在比赛中" /> Regex regBody = new Regex(@"(?is)<!-- publish_helper[^>]*>(.*?)<!-- publish_helper_end -->");
Match m = regBody.Match(yourStr);
if (m.Success)
{
richTextBox2.Text = m.Groups[1].Value;
} Regex regBody = new Regex(@"(?is)<!-- publish_helper[^>]*>.*?<!-- publish_helper_end -->");
Regex regTag = new Regex(@"<[^>]*>");
Match m = regBody.Match(yourStr);
if (m.Success)
{
richTextBox2.Text = regTag.Replace(m.Value, "");
}<p> 青少年<p>
<div style="text-align:center"><img alt="刘继在比赛中" src="http://i1.sinaimg.cn/ty/2010/0929/2010929101036.jpg" style="border:px solid #000000" title="刘继在比赛中" /></div>
<div style="margin: 5px 0; text-align: center;">刘继在比赛中</div>
<p> 陈彦p>