JavaScript RegExp toString()Method

RegExp 对象参考手册JavaScript RegExp Object

Example

Returns the string value of the regular expression:

var patt = new RegExp("EXAMPLE", "g"); var res = patt.toString();

Try it yourself »

Definition and Usage

The toString() method returns the string value of the regular expression.


Browser Support

The numbers in the table specify the first browser version that fully supports the method.

Method
toString() Yes Yes Yes Yes Yes

Syntax

RegExpObject.toString()

Parameters

No parameters.

Technical Details

Return value: String.
JavaScript Version: ECMAScript 1


RegExp 对象参考手册JavaScript RegExp Object

Other Extensions