RegExp.constructor (Property)

A reference to the constructor object for regular expressions.


ECMAScript edition - 3
JavaScript - 1.2
JScript - 3.0
Internet Explorer - 4.0
Netscape - 4.0
Opera 5.0
Property/method value type:RegExp object
JavaScript syntax:-myRegExp.constructor

The constructor is that of the built-in RegExp prototype object.

You can use this as one way of creating regular expressions although it is more popular to use the new RegExp() technique.

This property is useful if you have an object that you want to clone but you don't know what sort of object it is. Simply access the constructor belonging to the object you have a reference to.

Netscape Navigator provides constructors for many objects, virtually all of them in fact, even when it is highly inappropriate to do so. MSIE is far more selective and there are some occasions when you might wish for a constructor that MSIE does not make available.

See also:RegExp()


ECMA 262 edition 3 - section -