Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

JavaScript RegExp toString() method

JavaScript RegExp toString() method

RegExp Object Reference JavaScript RegExp Object

Example

Returns the string value of the regular expression:

var

patt

=

new

RegExp

(

"

RUNOOB

"

,

"

g

"

)

;

var

res

=

patt

.

toString

(

)

;

Try it »


Definition and Usage

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


Browser support

The numbers in the table indicate the first browser version that supports this method.

Method
toString() Yes Yes Yes Yes Yes

Syntax



RegExpObject.toString()

Parameters

No parameters.

Technical Details

Return value: The string.
JavaScript version: ECMAScript 1

RegExp Object Reference JavaScript RegExp Object