Commit 882363ab authored by 黄奎's avatar 黄奎

页面修改

parent 8540b52b
...@@ -189,10 +189,19 @@ namespace Edu.WebApi.Controllers.Course ...@@ -189,10 +189,19 @@ namespace Edu.WebApi.Controllers.Course
} }
// 定义正则表达式用来匹配 img 标签 // 定义正则表达式用来匹配 img 标签
string str=@"<img\b[^<>]*?\bsrc[\s\t\r\n]*=[\s\t\r\n]*[""']?[\s\t\r\n]*(?<imgUrl>[^\s\t\r\n""'<>]*)[^<>]*?/?[\s\t\r\n]*>"; string str=@"<img\b[^<>]*?\bsrc[\s\t\r\n]*=[\s\t\r\n]*[""']?[\s\t\r\n]*(?<imgUrl>[^\s\t\r\n""'<>]*)[^<>]*?/?[\s\t\r\n]*>";
string newTitle = ""; string newTitle = item.Title;
try try
{ {
newTitle = Regex.Replace(item.Title, str, "[图片]"); newTitle = Regex.Replace(newTitle, str, "[图片]");
}
catch
{
newTitle = item.Title;
}
try
{
newTitle = Regex.Replace(newTitle, @"<iframe\s*[^>]*>", "[音频", RegexOptions.IgnoreCase);
newTitle = Regex.Replace(newTitle, @"</iframe>", "]", RegexOptions.IgnoreCase);
} }
catch catch
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment