Search w3schools.com:

SHARE THIS PAGE

JavaScript RegExp [abc] Expression

RegExp Object Reference JavaScript RegExp Object

Definition and Usage

The [abc] expression is used to find any character between the brackets.

The characters inside the brackets can be any characters or span of characters.

Syntax

new RegExp("[abc]")

or simply:

/[abc]/


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The [abc] expression is supported in all major browsers.


Example

Example

Do a global search for the character-span [a-h] in a string:

var str="Is this all there is?";
var patt1=/[a-h]/g;

The marked text below shows where the expression gets a match:

Is this all there is?

Try it yourself »


RegExp Object Reference JavaScript RegExp Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]