This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

RegExp.prototype.ignoreCase

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2015년 7월⁩.

ignoreCase 접근자 속성은 i 플래그가 정규 표현식에 사용되었는지 여부를 가리킵니다.

시도해 보기

const regex1 = new RegExp("foo");
const regex2 = new RegExp("foo", "i");

console.log(regex1.test("Football"));
// Expected output: false

console.log(regex2.ignoreCase);
// Expected output: true

console.log(regex2.test("Football"));
// Expected output: true

설명

RegExp.prototype.ignoreCasei 플래그가 사용되었으먼 true값을 가집니다. 그렇지 않으면 false 값을 가집니다. i 플래그는 문자열 매칭에서 대소문자를 구분하지 않음을 가리킵니다.

정규식에 unicode 플래그가 있는 경우 대/소문자 케이스 매핑은 CaseFolding.txt에 명시된 대로 수행됩니다. 그렇지 않으면 대/소문자 매핑은 Unicode Default Case Conversion을 사용합니다. 이 알고리즘은 String.prototype.toUpperCase()String.prototype.toLowerCase()에서 사용되는 알고리즘과 동일합니다.

ignoreCase의 set 접근자는 undefined, 즉 정의되지 않았습니다. 이 속성을 직접 변경할 수 없습니다.

예제

ignoreCase 사용하기

js
const regex = /foo/i;

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

명세서

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

브라우저 호환성

같이 보기