Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify that lastIndex is RegExp instance property, not a static property #2725

Merged
merged 3 commits into from
Mar 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ <h3 id="Flags_in_constructor">Flags in constructor</h3>

<h3 id="Perl-like_RegExp_properties">Perl-like RegExp properties</h3>

<p>Note that several of the {{JSxRef("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.). See also <a href="/en-US/docs/Web/JavaScript/Reference/Deprecated_and_obsolete_features#RegExp_Properties">deprecated <code>RegExp</code> properties.</a></p>
<p>Note that several of the {{JSxRef("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.). See also <a href="/en-US/docs/Web/JavaScript/Reference/Deprecated_and_obsolete_features#regexp_properties">deprecated <code>RegExp</code> properties.</a></p>

<h2 id="Constructor">Constructor</h2>

Expand All @@ -64,8 +64,6 @@ <h2 id="Static_properties">Static properties</h2>
<dl>
<dt>{{jsxref("RegExp.@@species", "get RegExp[@@species]")}}</dt>
<dd>The constructor function that is used to create derived objects.</dd>
<dt>{{jsxref("RegExp.lastIndex")}}</dt>
<dd>The index at which to start the next match.</dd>
</dl>

<h2 id="Instance_properties">Instance properties</h2>
Expand All @@ -87,6 +85,8 @@ <h2 id="Instance_properties">Instance properties</h2>
<dd>Whether or not the search is sticky.</dd>
<dt>{{JSxRef("RegExp.prototype.unicode")}}</dt>
<dd>Whether or not Unicode features are enabled.</dd>
<dt>{{jsxref("RegExp.lastIndex", "RegExp: lastIndex")}}</dt>
<dd>The index at which to start the next match.</dd>
</dl>

<h2 id="Instance_methods">Instance methods</h2>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: RegExpInstance.lastIndex
title: 'RegExp: lastIndex'
slug: Web/JavaScript/Reference/Global_Objects/RegExp/lastIndex
tags:
- JavaScript
Expand All @@ -10,7 +10,9 @@
---
<div>{{JSRef}}</div>

<p>The <strong><code>lastIndex</code></strong> is a read/write integer property of regular expression instances that specifies the index at which to start the next match.</p>
<p><strong><code>lastIndex</code></strong> is a read/write integer property of {{jsXref("RegExp")}} instances that specifies the index at which to start the next match.</p>

<p>Note that <code>lastIndex</code> is not a property of the {{jsXref("RegExp")}} prototype but is instead only exposed from {{jsXref("RegExp")}} instances.</p>

<div>{{EmbedInteractiveExample("pages/js/regexp-lastindex.html")}}</div>

Expand Down Expand Up @@ -60,7 +62,7 @@ <h2 id="Specifications">Specifications</h2>
</thead>
<tbody>
<tr>
<td>{{SpecName('ESDraft', '#sec-properties-of-regexp-instances', 'RegExp.lastIndex')}}</td>
<td>{{SpecName('ESDraft', '#sec-properties-of-regexp-instances', 'lastIndex')}}</td>
</tr>
</tbody>
</table>
Expand Down