JavaScript RegExp iModifier
JavaScript RegExp Object
Definition and Usage
The i modifier is used to perform case-insensitive matching.
Syntax
new RegExp("regexp","i")
Or a simpler way:
/regexp/i
Or a simpler way:
/regexp/i
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the i modifier.
Example
Example
Perform a case-insensitive search for "example" in the string:
var str="Visit example";
var patt1=/example/i;
var patt1=/example/i;
Belowmarkedtext shows the position where the expression obtained a match:
Visit example
Try it yourself »
JavaScript RegExp Object Other Extensions