Home » JavaScript RegExp toString() Method

JavaScript RegExp toString() Method

by Online Tutorials Library

JavaScript RegExp.prototype.toString() Method

The toString() method returns a string which represents the regular expression.

Syntax

Parameters

NA

Return value

This method returns the string representing the given object.

Example 1

Test it Now

Output:

Returned value : /(?:)/g  

Example 2

Test it Now

Output:

/a+b+c/g/  gt+yu//  abcd//  n/g  

Example 3

Test it Now

Output:

Returned value : /script/g  Returned value : /(?:)/g  
Next TopicJavaScript RegExp

You may also like