//字符串
var str='<img src="https://fhfgjfdh/2.gif" alt="/::B">hello<img src="https://idufid/emotion/3.gif" alt="/::|">';
//正则
var preg=/<img(.+)alt="/ig;
//替换为空
str=str.replace(preg,'');
我想得到的结果是/::B">hello/::|">,但现在结果为/::|",要怎么修改呢?
/::B">hello/::|">
/::|"
人到中年有点甜
相关分类