try { console.log(new RegExp('a', 'xy').test('')); } catch (e) { }