X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR BOOTSTRAP XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

JavaScript RegExp toString Method

RegExp Object Reference JavaScript RegExp Object

Example

Return the string value of the regular expression:

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

The result of res will be:

/Hello World/g

Try it yourself »


Definition and Usage

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


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The toString() method is supported in all major browsers.


Syntax

RegExpObject.toString()

Parameters

None.

Return Value

Type Description
String The string value of the regular expression

Technical Details

JavaScript Version: 1.1


RegExp Object Reference JavaScript RegExp Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook