class RegExp1 extends RegExp {
[Symbol.split](str, limit) {
const result = RegExp.prototype[Symbol.split].call(this, str, limit);
return result.map((x) => `(${x})`);
}
}
console.log('2016-01-02'.split(new RegExp1('-')));
// Expected output: Array ["(2016)", "(01)", "(02)"]
console.log('2016-01-02'.split(new RegExp('-')));
// Expected output: Array ["2016", "01", "02"]