Add call and apply methods to RegExp.prototype

StevenLevithan steves_list at
Fri Dec 21 07:33:38 PST 2007

Yes, its easy to pull off oneself, so I don't care much other way. Still, it
seems pretty weird to me to be able to do ``regex(str)`` but not
``, str)``. This is accentuated when typeof returns
"function" for regexes (though it seems ES4 will change this to "object").

Yuh-Ruey Chen wrote:
> Sounds like a good idea to me. On the other hand, this can already
> easily be done in ES3.
> Steven L. wrote:
>> ES4 proposals include making regexes callable as a function on a
>> single string argument, which serves as a shorthand for calling the
>> regex's exec method. To further extend this idea, what about also
>> including call and apply methods on RegExp.prototype ...

View this message in context:
Sent from the Mozilla - ECMAScript 4 discussion mailing list archive at

More information about the Es4-discuss mailing list