let name = `
<div>
<image src='aaaa'></image>
<image src='1111'></image>
<image src='222'></image>
<image src='33333'></image>
<image
src='3333'
></image>
</div>
`;
// 正则匹配标签,支持换行
console.log(name)
let uw = name.replace(/<image[^>]*?><\/image>/g, function (word) {
console.log(word)
// return word.substring(0,1).toUpperCase()+word.substring(1);
}
);
第二种案例
let name = `
<div
sss
>
<image src='aaaa'></image>
<image src='1111'></image>
<image src='222'></image>
<image src='33333'></image>
<image
src='3333'
></image>
</div>
<div></div>
`;
// 正则匹配标签,支持换行
// console.log(name)
let uw = name.replace(/<div[^>]*?>([^]*)<\/div>/g, function (word) {
console.log(word)
// return word.substring(0,1).toUpperCase()+word.substring(1);
}
);