function RemoveASCIIControlCharacters(xmlString) {
var cleanXmlString = xmlString.replace(/VT/g,'');
cleanXmlString = cleanXmlString.replace(/SUB/g, '');
return cleanXmlString;
}
Please replace VT and SUB with real control character.
The removal of the VT control character works. However the removal of the SUB control character fails.
How do I filter out the SUB(0x1A) control character?
答案 0 :(得分:0)
使用\ xY,其中Y是十六进制字符代码,例如。对于两者:
return cleanXmlString.replace(/[\x0b\x1a]/g, ''));
答案 1 :(得分:0)
您可以使用八进制字符转义和范围:/[\0-\32]/g