Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

RegExp i modifier

JavaScript RegExp i modifier

RegExp Object Reference JavaScript RegExp Object


Definition and Usage

The i modifier performs case-insensitive matching.

Syntax

new RegExp("

regexp

","i")

Or a simpler way:

/

regexp

/i


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the i modifier.


Example

Example

Perform a case-insensitive search for "runoob" in the string:

var str="Visit RUnoob";

var patt1=/runoob/i;

The text marked below shows where the expression found matches:

Visit

RUnoob

Try it »


RegExp Object Reference JavaScript RegExp Object