This feature allows RegExp subclasses to override RegExp.prototype.exec and flags to change the semantics of higher-level functionality, such as String.prototype.replace. Previous JavaScript versions always used the original value of exec from replace. This feature makes it easier to implement new RegExp subclasses by changing a single core piece, without duplicating the higher level integration logic.