为什么正则表达式字符\0
(或\000
)与我的文字中的html特殊字符�
不匹配,而它与任何其他html特殊字符\001
匹配得很好; 
,\002

,\044
$
等?
var txtA = document.getElementById('textA').textContent;
var txtB = document.getElementById('textB').textContent;
var txtC = document.getElementById('textC').textContent;
var hasLineBreak = /\010|\n/g;
var hasNul = /\0|\00|\000/g;
var hasDollar = /\$|\044/g;
console.log("\\n: ",hasLineBreak.test(txtA));
console.log("\\0: ",hasNul.test(txtB));
console.log("$: ",hasDollar.test(txtC));
#textA{
white-space: pre-wrap;
}
#textA, #textB, #textC{
display:inline-block;
border: solid 1px #33aaff;
margin:4px;
}
<div id="textA">this is some 
text with line break</div>
<div id="textB">this is some text with � null</div>
<div id="textC">this is some text with $ dollar sign</div>