Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
지원이 중단되었습니다: 이 기능은 더 이상 권장되지 않습니다. 일부 브라우저에서는 아직 지원할 수 있지만 관련 웹 표준에서 이미 제거되었거나 제거 과정에 있는 경우가 있으며, 호환성을 위해 유지되고 있을 수 있습니다. 사용을 피하고 가능하다면 기존 코드를 업데이트하세요. 결정을 지원할 하단의 호환성 표를 확인하세요. 이 기능은 언제든지 작동을 중단할 수 있음을 유의하세요.
참고 : compile() 메서드는 호환성을 위해서만 명시되어 있습니다. compile()을 사용하면 변경 불가능한 정규식 소스와 플래그가 변경 가능하므로 사용자의 예상을 빗나갈 수 있습니다. 대신 RegExp() 생성자를 사용하여 새 정규식 객체를 생성할 수 있습니다.
RegExp 인스턴스의 compile() 메서드는 RegExp 객체가 이미 생성된 후 새로운 소스와 플래그를 사용하여 정규식을 다시 컴파일하는 데 사용됩니다.
정규 표현식 텍스트
flags플래그 값의 조합.
없음 (undefined).
다음 예제는 새로운 패턴과 새로운 플래그를 사용하여 정규식을 다시 컴파일하는 방법을 보여 줍니다.
| ECMAScript® 2027 Language Specification # sec-regexp.prototype.compile |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025년 10월 9일 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.