I don't know why you need this syntax, but here is something for lulz:
RegExp = (function(){ var old = RegExp; return function(){ return old.prototype.exec.bind( old.apply( this, arguments ) ); }; })()
Then:
new RegExp( "[0-9]{3}" )('23 2 34 678 9 09')
Please note that when using literals, the hack constructor will not be called, so it only works when using new RegExp
; P
Esailija
source share