Regex reg = new Regex("){1}"); //匹配
Regex regHref = new Regex("path=(.*)[\"|']"); //匹配 path="*"
string strNewsContentTemp = FCKeditor_NewsEditor.Value; //abcabc bc
string yuan="";
string mu = "";
MatchCollection matches = reg.Matches(strNewsContentTemp); //匹配结果的集合
for (int i = 0; i
if (regHref.IsMatch(yuan)) //如果含有path="*"
{
string hrefYuan = regHref.Matches(yuan)[0].Value; // path=/中文.aspx"
hrefYuan = hrefYuan.Substring(0, hrefYuan.Length - 1); // path=/中文.aspx
hrefYuan = hrefYuan.Substring(6); // 中文.aspx
string hrefMu = Server.UrlEncode(hrefYuan); //转码
mu = yuan.Replace(hrefYuan, hrefMu); //替换字符串 不认识的.aspx
strNewsContentTemp = strNewsContentTemp.Replace(yuan, mu); //将中的中文.aspx换成 不认识的.aspx
}
}
News.NewsContent = strNewsContentTemp;
Regex regHref = new Regex("path=(.*)[\"|']"); //匹配 path="*"
string strNewsContentTemp = FCKeditor_NewsEditor.Value; //abcabc bc
string yuan="";
string mu = "";
MatchCollection matches = reg.Matches(strNewsContentTemp); //匹配结果的集合
for (int i = 0; i
if (regHref.IsMatch(yuan)) //如果含有path="*"
{
string hrefYuan = regHref.Matches(yuan)[0].Value; // path=/中文.aspx"
hrefYuan = hrefYuan.Substring(0, hrefYuan.Length - 1); // path=/中文.aspx
hrefYuan = hrefYuan.Substring(6); // 中文.aspx
string hrefMu = Server.UrlEncode(hrefYuan); //转码
mu = yuan.Replace(hrefYuan, hrefMu); //替换字符串 不认识的.aspx
strNewsContentTemp = strNewsContentTemp.Replace(yuan, mu); //将中的中文.aspx换成 不认识的.aspx
}
}
News.NewsContent = strNewsContentTemp;