正则问题 ,求帮帮忙 Regex objRegExp = new Regex("<(.|\n)+?>"); string strOutput = objRegExp.Replace(strHtml, "#"); strOutput = objRegExp.Replace(strOutput, ""); strOutput = strOutput.Replace("<", "<"); strOutput = strOutput.Replace(">", ">"); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 strHtml = strHtml.Replace("\n", "");strHtml = strHtml.Replace("\r", "");Regex objRegExp = new Regex("<(.|\n)+?>");string strOutput = objRegExp.Replace(strHtml, "#");strOutput = objRegExp.Replace(strOutput, "");strOutput = strOutput.Replace("<", "<");strOutput = strOutput.Replace(">", ">");试下把\n和\r替换了 输出的内容不带 html标签 我想要输出的内容带 html 所以才替换成实体字符 要这个样子?string aa = @"<div>aaa</div>";返回<div>aaa</div> 那就直接Replace字符串就好了,用什么正则表达式呀。你要一定用的话 strHtml = strHtml.Replace("\n", ""); strHtml = strHtml.Replace("\r", ""); Regex objRegExp = new Regex("<"); string strOutput = strHtml; strOutput = objRegExp.Replace(strOutput, "<"); objRegExp = new Regex(">"); strOutput = objRegExp.Replace(strOutput, ">"); 为什么非要用正则做事呢?直接用这个不就OK了直接用Server.UrlEncode(htmlString); 这种像c#的格式用什么编辑器来实现? 关于界面载入后反复调用JS问题 这三个类,用那一个类发送邮件比较好? DataGrid编辑项中提取出FileUpload的值 freetextbox在用window.showModalDialog打开的页面中变得无法编辑? asp.net中的这样一个问题,望指教!!!! 怪问题,第一次见,急 寻找TreeView控件 水晶报表拒绝访问的问题 .net上传文件如何实现不重复上传? asp.net页面上点下按钮生成文件并马上返回,文件同时异步生成的功能怎么实现 谁有windows server 安全方面的资料?
strHtml = strHtml.Replace("\r", "");
Regex objRegExp = new Regex("<(.|\n)+?>");
string strOutput = objRegExp.Replace(strHtml, "#");
strOutput = objRegExp.Replace(strOutput, "");
strOutput = strOutput.Replace("<", "<");
strOutput = strOutput.Replace(">", ">");试下把\n和\r替换了
输出的内容不带 html标签
我想要输出的内容带 html 所以才替换成实体字符
string aa = @"<div>aaa</div>";
返回
<div>aaa</div>
你要一定用的话
strHtml = strHtml.Replace("\n", "");
strHtml = strHtml.Replace("\r", "");
Regex objRegExp = new Regex("<");
string strOutput = strHtml;
strOutput = objRegExp.Replace(strOutput, "<");
objRegExp = new Regex(">");
strOutput = objRegExp.Replace(strOutput, ">");
直接用
Server.UrlEncode(htmlString);