JavaScript - RegExp toSource Method



Description

The toSource method string represents the source code of the object. This method does not work with all the browsers.

This method does not work with all the browsers.

Syntax

Its syntax is as follows −

RegExpObject.toSource();

Return Value

Returns the string representing the source code of the object.

Example

Try the following example program.


   
      JavaScript RegExp toSource Method
   
   
   
      
   

Output

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