JavaScript RegExp constructor property

Definition and usage

constructor The property returns the function that creates the RegExp prototype.

For regular expressions, the constructor property returns:

function RegExp() { [native code] }

Instance

The constructor property returns the constructor function of the RegExp.

let pattern = /Hello World/g;
let text = pattern.constructor;

Try it yourself

Syntax

regexp.constructor

Return value

function RegExp() { [native code] }

Browser Support

constructor Is ECMAScript1 (ES1) Feature.

All browsers fully support ES1 (JavaScript 1997):

Chrome IE Edge Firefox Safari Opera
Support Support Support Support Support Support