日期:2014-05-17  浏览次数:20399 次

正则问题 ,求帮帮忙



把<  > 标记 用正则替换成  &lt;  &gt; 

------解决方案--------------------

            Regex objRegExp = new Regex("<(.
------解决方案--------------------
\n)+?>");
            string strOutput = objRegExp.Replace(strHtml, "#");
            strOutput = objRegExp.Replace(strOutput, "");
            strOutput = strOutput.Replace("<", "&lt;");
            strOutput = strOutput.Replace(">", "&gt;");
------解决方案--------------------
为什么非要用正则做事呢?直接用这个不就OK了
直接用

Server.UrlEncode(htmlString);