js 把当前字串里面mjx-assistive-mml 元素标签包括内容删除掉mjx-container class=MathJax CtxtMenu_Attached_0 jax=SVG tabindex=0 ctxtmenu_counter=249 style=position relative;svg xmlns=httpwwww3org2000svg width=11893ex heigh
你可以使用正则表达式来删除给定字符串中的指定内容。以下是使用JavaScript中的replace()函数和正则表达式来删除
var str = '...'; // 你的字符串
var result = str.replace(/<mjx-assistive-mml\b[^>]*>[\s\S]*?<\/mjx-assistive-mml>/g, '');
console.log(result);
在上面的代码中,我们使用了正则表达式/<mjx-assistive-mml\b[^>]*>[\s\S]*?<\/mjx-assistive-mml>/g来匹配<mjx-assistive-mml>元素标签及其内容。然后,我们使用replace()函数将匹配到的内容替换为空字符串,从而删除了这些内容。
请注意,上述代码中的...表示你的字符串,你需要将其替换为实际的字符串。
原文地址: https://www.cveoy.top/t/topic/ikN8 著作权归作者所有。请勿转载和采集!