Table of contents
- 1. Summary
- 2. Syntax
- 3. Parameters
- 4. Description
- 5. Examples
- 6. See Also
Summary
Returns a string representing the specified object.
Method of RegExp | |
|---|---|
| Implemented in | JavaScript 1.1 |
| ECMAScript Edition | ECMAScript 3rd Edition |
Syntax
regexp.toString()
Parameters
None.
Description
The RegExp object overrides the toString method of the Object object; it does not inherit Object.toString. For RegExp objects, the toString method returns a string representation of the regular expression.
Examples
Example: Using toString
The following example displays the string value of a RegExp object:
myExp = new RegExp("a+b+c");
alert(myExp.toString()); // displays "/a+b+c/"