JavaScript RegExp [abc] 運算式

定義和用法
[abc] 運算式用於查找方括號之間的任何字元。
方括號內的字元可以是任何字元或字元範圍。
語法
new RegExp("[abc]")
或者更簡單方式:
/[abc]/
或者更簡單方式:
/[abc]/
流覽器支持
所有主要流覽器都支持 [abc] 運算式
實例
實例
在字串中對字元範圍 [a-h] 進行全局搜索:
var str="Is this all there is?";
var patt1=/[a-h]/g;
var patt1=/[a-h]/g;
下麵被標記的文本顯示了運算式獲得匹配的位置:
Is this all there is?
