RegExp [abc] expression
Definition and Usage
[Abc] expression is used to find any character between the brackets.
Characters in square brackets can be any character or character range.
grammar
new RegExp("[abc]")
或者更简单方式:
/[abc]/
或者更简单方式:
/[abc]/
Browser Support
All major browsers support [abc] expression
Examples
Examples
In a string of characters in the range [ah] global search:
var str="Is this all there is?";
var patt1=/[a-h]/g;
var patt1=/[a-h]/g;
The marked text below shows where the expression gets a match:
Is t h is a ll t he r e is?
try it"
JavaScript RegExp Object