The ignoreCase
property indicates whether or not the "i
" flag is used with the regular expression. ignoreCase
is a read-only property of an individual regular expression instance.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
Property attributes of RegExp.prototype.ignoreCase |
|
---|---|
Writable | no |
Enumerable | no |
Configurable | yes |
Description
The value of ignoreCase
is a Boolean
and true
if the "i
" flag was used; otherwise, false
. The "i
" flag indicates that case should be ignored while attempting a match in a string.
You cannot change this property directly.
Examples
Using ignoreCase
var regex = new RegExp('foo', 'i'); console.log(regex.ignoreCase); // true
Specifications
Specification |
---|
ECMAScript (ECMA-262) The definition of 'RegExp.prototype.ignoreCase' in that specification. |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | Server | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ignoreCase | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 5.5 | Opera Full support 5 | Safari Full support 1 | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support 10.1 | Safari iOS Full support 1 | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
Prototype accessor property (ES2015) | Chrome Full support 48 | Edge Full support 12 | Firefox Full support 38 | IE Full support 5.5 | Opera Full support 35 | Safari Full support 1.3 | WebView Android Full support 48 | Chrome Android Full support 48 | Firefox Android Full support 38 | Opera Android Full support 35 | Safari iOS Full support 1 | Samsung Internet Android Full support 5.0 | nodejs Full support Yes |
Legend
- Full support
- Full support