描述
\0 匹配 NUL 字符 (\u0000)。
例子
以下示例显示了 RegExp 表达式的用法。
<script type = "text/javascript">
var str = "ab\0c";
var pattern = /\0/g;
var index = str.search(pattern);
document.write("测试1 - 返回值 : " + index);
str = "abc";
index = str.search(pattern);
document.write("<br/>测试2 - 返回值 : " + index);
</script>
输出
测试1 - 返回值 : 2
测试2 - 返回值 : -1
测试2 - 返回值 : -1