描述
[...] 检查搜索的字符串中是否存在方括号之间的任何一个字符。
例子
以下示例显示了 RegExp 表达式的用法。
<script type = "text/javascript">
var str = "first";
var pattern = /[abcde]/g;
var result = str.match(pattern);
document.write("Test 1 - returned value : " + result);
str = "second";
result = str.match(pattern);
document.write("<br/>Test 2 - returned value : " + result);
</script>
输出
Test 1 - returned value : null
Test 2 - returned value : e,c,d
Test 2 - returned value : e,c,d