62,041
社区成员
发帖
与我相关
我的任务
分享
string test = "<a href='http://www.baidu.com' ><embed src=\"http://d.lanrentuku.com/lanren/flashad/300x250-0281.swf\" width=\"300\" height=\"250\" type=\"application/x-shockwave-flash\" scale=\"\" play=\"true\" loop=\"true\" menu=\"true\"></embed></a>object 标签中的 <param name=\"movie\" value=\"x.swf\">";
Regex reg = new Regex(@"(?is)(<(?:embed|param)\b[^>]*?(?:src|value)=(['""]?))[^'""\s>]+(\2[^>]*>)");
string result = reg.Replace(test, "$1想换成什么,就换成什么!$3");
richTextBox2.Text = result;
/*-------输出-------
<a href='http://www.baidu.com' ><embed src="想换成什么,就换成什么!" width="300" height="250" type="application/x-shockwave-flash" scale="" play="true" loop="true" menu="true"></embed></a>object 标签中的 <param name="movie" value="想换成什么,就换成什么!">
*/