我有一个包含一些HTML / XML的字符串。我想要做的就是去除除正则表达式中提到的字符之外的所有字符的字符串。
我想摆脱所有拉丁语和其他字母,如''。代码段中的代码无效。
我错过了什么吗?
var essay = "<span style='mso-spacerun:yes'> Â Â Â Â </span>as follows: <br style='mso-special-character:line-break'><![if !supportLineBreakNewLine]><br style='mso-special-character:line-break'><![endif]></span></b><span style='font-family:\"Segoe UI\",\"Lucida Grande\";color:#333333'><o:p></o:p></span></p><p style='margin-bottom:0in;margin-bottom:.0001pt;line-height:normal;tab-stops:.5in 1.0in 1.5in 2.0in 2.5in 3.0in 3.5in 4.0in 4.5in 5.0in 5.5in 6.0in 6.5in 7.0in;mso-layout-grid-align:none;text-autospace:none'><span style='font-family:\"Segoe UI\",\"Lucida Grande\";color:#333333'><span style='mso-tab-count:1'> Â Â Â Â Â Â Â Â Â Â Â </span>";
essay = essay.replace("/([^A-Za-z0-9></\";=\':#.!,-\]\[\s\(\)&])+/g", " ");
console.log(essay);