Apply your JS skills to key Mozilla projects as an MDN Fellow! http://mzl.la/MDNFellowship

mozilla

Revision 298170 of RegExp.prototype

  • Revision slug: JavaScript/Reference/Global_Objects/RegExp/prototype
  • Revision title: RegExp.prototype
  • Revision id: 298170
  • Created:
  • Creator: evilpie
  • Is current revision? No
  • Comment

Revision Content

Summary

Represents the prototype object for the RegExp constructor.

Description

See RegExp for a description of RegExp instances.

RegExp instances inherit from RegExp.prototype. Modifications to the prototype object are propagated to all RegExp instances.

Properties

See also Deprecated RegExp Properties

Note that several of the RegExp properties have both long and short (Perl-like) names. Both names always refer to the same value. Perl is the programming language from which JavaScript modeled its regular expressions.

constructor
Specifies the function that creates an object's prototype.
global
Whether to test the regular expression against all possible matches in a string, or only against the first.
ignoreCase
Whether to ignore case while attempting a match in a string.
lastIndex
The index at which to start the next match.
multiline
Whether or not to search in strings across multiple lines.
source
The text of the pattern.
sticky {{ Fx_minversion_inline(3) }} {{ non-standard_inline() }}
Whether or not the search is sticky.
{{ jsOverrides("Object", "properties", "constructor", "global", "ignoreCase", "lastIndex", "multiline", "source", "sticky") }}

Methods

See also Deprecated RegExp Methods

exec
Executes a search for a match in its string parameter.
test
Tests for a match in its string parameter.
toSource {{ Non-standard_inline() }}
Returns an object literal representing the specified object; you can use this value to create a new object. Overrides the Object.prototype.toSource method.
toString
Returns a string representing the specified object. Overrides the Object.prototype.toString method.
{{ jsOverrides("Object", "Methods", "exec", "test", "toSource", "toString") }}

See also

Revision Source

<h2 id="Summary" name="Summary">Summary</h2>
<p>Represents the prototype object for the <a href="/en-US/docs/JavaScript/Reference/Global_Objects/RegExp" title="en-US/docs/JavaScript/Reference/Global_Objects/RegExp"><code>RegExp</code></a> constructor.</p>
<h2 id="Description" name="Description">Description</h2>
<p>See <a class="internal" href="/en-US/docs/JavaScript/Reference/Global_Objects/RegExp#RegExp_instances" title="en-US/docs/Core JavaScript 1.5 Reference/Global Objects/RegExp#RegExp_instances"><code>RegExp</code></a> for a description of <code>RegExp</code> instances.</p>
<p><code>RegExp</code> instances inherit from <code>RegExp.prototype</code>. Modifications to the prototype object are propagated to all <code>RegExp</code> instances.</p>
<h2 id="Properties" name="Properties">Properties</h2>
<p>See also <a href="/en-US/docs/JavaScript/Reference/Deprecated_Features#RegExp_Properties" title="en-US/docs/JavaScript/Reference/Deprecated_Features#RegExp_Properties">Deprecated RegExp Properties</a></p>
<p>Note that several of the <code>RegExp</code> properties have both long and short (Perl-like) names. Both names always refer to the same value. Perl is the programming language from which JavaScript modeled its regular expressions.</p>
<dl>
  <dt>
    <a href="/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/constructor" title="en-US/docs/JavaScript/Reference/Global_Objects/RegExp/constructor"><code>constructor</code></a></dt>
  <dd>
    Specifies the function that creates an object's prototype.</dd>
  <dt>
    <a href="/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/global" title="en-US/docs/JavaScript/Reference/Global_Objects/RegExp/global"><code>global</code></a></dt>
  <dd>
    Whether to test the regular expression against all possible matches in a string, or only against the first.</dd>
  <dt>
    <a href="/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/ignoreCase" title="en-US/docs/JavaScript/Reference/Global_Objects/RegExp/ignoreCase"><code>ignoreCase</code></a></dt>
  <dd>
    Whether to ignore case while attempting a match in a string.</dd>
  <dt>
    <a href="/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/lastIndex" title="en-US/docs/JavaScript/Reference/Global_Objects/RegExp/lastIndex"><code>lastIndex</code></a></dt>
  <dd>
    The index at which to start the next match.</dd>
  <dt>
    <a href="/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/multiline" title="en-US/docs/JavaScript/Reference/Global_Objects/RegExp/multiline"><code>multiline</code></a></dt>
  <dd>
    Whether or not to search in strings across multiple lines.</dd>
  <dt>
    <a href="/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/source" title="en-US/docs/JavaScript/Reference/Global_Objects/RegExp/source"><code>source</code></a></dt>
  <dd>
    The text of the pattern.</dd>
  <dt>
    <a href="/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/sticky" title="en-US/docs/JavaScript/Reference/Global_Objects/RegExp/sticky"><code>sticky</code></a> {{ Fx_minversion_inline(3) }} {{ non-standard_inline() }}</dt>
  <dd>
    Whether or not the search is sticky.</dd>
</dl>
<div>
  {{ jsOverrides("Object", "properties", "constructor", "global", "ignoreCase", "lastIndex", "multiline", "source", "sticky") }}</div>
<h2 id="Methods" name="Methods">Methods</h2>
<p>See also <a href="/en-US/docs/JavaScript/Reference/Deprecated_Features#RegExp_Methods" title="en-US/docs/JavaScript/Reference/Deprecated_Features#RegExp_Methods">Deprecated RegExp Methods</a></p>
<dl>
  <dt>
    <a href="/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/exec" title="en-US/docs/JavaScript/Reference/Global_Objects/RegExp/exec"><code>exec</code></a></dt>
  <dd>
    Executes a search for a match in its string parameter.</dd>
  <dt>
    <a href="/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/test" title="en-US/docs/JavaScript/Reference/Global_Objects/RegExp/test"><code>test</code></a></dt>
  <dd>
    Tests for a match in its string parameter.</dd>
  <dt>
    <a href="/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/toSource" title="en-US/docs/JavaScript/Reference/Global_Objects/RegExp/toSource"><code>toSource</code></a> {{ Non-standard_inline() }}</dt>
  <dd>
    Returns an object literal representing the specified object; you can use this value to create a new object. Overrides the Object.prototype.toSource method.</dd>
  <dt>
    <a href="/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/toString" title="en-US/docs/JavaScript/Reference/Global_Objects/RegExp/toString"><code>toString</code></a></dt>
  <dd>
    Returns a string representing the specified object. Overrides the <a href="/en-US/docs/JavaScript/Reference/Global_Objects/Object/toString" title="en-US/docs/JavaScript/Reference/Global_Objects/Object/toString"><code>Object.prototype.toString</code></a> method.</dd>
</dl>
<div>
  {{ jsOverrides("Object", "Methods", "exec", "test", "toSource", "toString") }}</div>
<h2 id="See_also" name="See_also">See also</h2>
<ul>
  <li><a href="/en-US/docs/JavaScript/Reference/Global_Objects/RegExp" title="en-US/docs/JavaScript/Reference/Global_Objects/RegExp"><code>RegExp</code></a></li>
  <li><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Function/prototype" title="en-US/docs/JavaScript/Reference/Global_Objects/Function/prototype"><code>Function.prototype</code></a></li>
</ul>
Revert to this revision