Commit 13a2683b authored by 吴春's avatar 吴春

Merge branch 'master' of http://gitlab.oytour.com/Kui2/education

parents 636ecfbd 4b02f596
......@@ -12,6 +12,7 @@ using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Edu.WebApi.Controllers.Course
{
......@@ -88,11 +89,22 @@ namespace Edu.WebApi.Controllers.Course
{
item.UpdateByName = UserReidsCache.GetUserLoginInfo(item.UpdateBy)?.AccountName ?? "";
}
// 定义正则表达式用来匹配 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 newTitle = "";
try
{
newTitle = Regex.Replace(item.Title, str, "[图片]");
}
catch (Exception ex)
{
newTitle = item.Title;
}
resultList.Add(new
{
item.QuestionId,
item.CourseId,
item.Title,
Title= newTitle,
item.QuestionTypeId,
item.QuestionTypeKey,
item.QuestionTypeName,
......
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