RegExp.prototype.toSource()

  • Revision slug: JavaScript/Reference/Global_Objects/RegExp/toSource
  • Revision title: toSource
  • Revision id: 16346
  • Created:
  • Creator: evilpie
  • Is current revision? No
  • Comment 3 words added, 3 words removed

Revision Content

{{ Non-standard_header() }}

Returns a string representing the source code of the object.

Method of RegExp
Implemented in 1.3
ECMAScript Edition none

Syntax

regexp.toSource()

Parameters

None.

Description

The toSource method returns the following values:

This shouldn't be here, but until reorganization where pages are moved to their proper places, the title of this article is ambiguous, so it can stay. After reorganization, this should be removed.

  • For the built-in RegExp object, toSource returns the following string indicating that the source code is not available:
function RegExp() {[native code]}
  • For instances of RegExp, toSource returns a string representing the source code.

This method is usually called internally by JavaScript and not explicitly in code.

See Also

Object.prototype.toSource

{{ languages( { "ja": "ja/Core_JavaScript_1.5_Reference/Global_Objects/RegExp/toSource", "pl": "pl/Dokumentacja_j\u0119zyka_JavaScript_1.5/Obiekty/RegExp/toSource" } ) }}

Revision Source

<p>
{{ Non-standard_header() }}
</p>
<p>Returns a string representing the source code of the object.
</p>
<table class="standard-table"> <thead> <tr> <th class="header" colspan="2">Method of <a href="/en/JavaScript/Reference/Global_Objects/RegExp"><code>RegExp</code></a></th> </tr> </thead> <tbody> <tr> <td>Implemented in</td> <td>1.3</td> </tr> <tr> <td>ECMAScript Edition</td> <td>none</td> </tr> </tbody>
</table> <h3 name="Syntax"> Syntax </h3>
<p><code><i>regexp</i>.toSource()</code>
</p>
<h3 name="Parameters"> Parameters </h3>
<p>None.
</p>
<h3 name="Description"> Description </h3>
<p>The <code>toSource</code> method returns the following values:
</p><p><span class="comment">This shouldn't be here, but until reorganization where pages are moved to their proper places, the title of this article is ambiguous, so it can stay. After reorganization, this should be removed.</span>
</p>
<ul><li> For the built-in <code>RegExp</code> object, <code>toSource</code> returns the following string indicating that the source code is not available:
</li></ul>
<pre class="eval">function RegExp() {[native code]}
</pre>
<ul><li> For instances of <code>RegExp</code>, <code>toSource</code> returns a string representing the source code.
</li></ul>
<p>This method is usually called internally by JavaScript and not explicitly in code.
</p>
<h3 name="See_Also"> See Also </h3>
<p><a href="en/Core_JavaScript_1.5_Reference/Global_Objects/Object/toSource">Object.prototype.toSource</a>
</p>
<div class="noinclude">
</div>
{{ languages( { "ja": "ja/Core_JavaScript_1.5_Reference/Global_Objects/RegExp/toSource", "pl": "pl/Dokumentacja_j\u0119zyka_JavaScript_1.5/Obiekty/RegExp/toSource" } ) }}
Revert to this revision