后端给返的接口内容是
<p>为什么这里有这个问题为什么呢<img src='http://192.168.2.5:2345/Image/.png/58c7c1e66b23d27e23a6f007f38bae3d.png' /></p>↵<p>为什么要这样子呢</p>
只需要拿到第一句话的
为什么这里有这个问题为什么呢
js代码为
let content = "<p>为什么这里有这个问题为什么呢<img src='http://192.168.2.5:2345/Image/.png/58c7c1e66b23d27e23a6f007f38bae3d.png' /></p>↵<p>为什么要这样子呢</p>";
let reg = /(?<=>)(.+?)(?=<)/g;
let arr = content.match(reg)
console.log("全部内容:",content);
console.log("截取后内容:",arr[0]);