JavaScript RegExp - toString



Description

The toString method returns a string representation of a regular expression in the form of a regular-expression literal.

Syntax

Its syntax is as follows −

RegExpObject.toString();

Return Value

Returns the string representation of a regular expression.

Example


   
   
      JavaScript RegExp toString Method
   
   
   
      
   

Output

Test 1 - returned value : /script/g
Test 2 - returned value : /\//g
Advertisements