The ignoreCase accessor property indicates whether or not the i flag is used with the regular expression.

Try it


RegExp.prototype.ignoreCase has the value 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.

If the regex has the unicode flag, the case mapping happens as specified in CaseFolding.txt. Otherwise, case mapping uses the Unicode Default Case Conversion — the same algorithm used in String.prototype.toUpperCase() and String.prototype.toLowerCase().

The set accessor of ignoreCase is undefined. You cannot change this property directly.


Using ignoreCase

const regex = /foo/i;

console.log(regex.ignoreCase); // true


ECMAScript Language Specification
# sec-get-regexp.prototype.ignorecase

Browser compatibility

BCD tables only load in the browser

See also