diff options
Diffstat (limited to 'files/pl/web/javascript/reference/global_objects/regexp/lastmatch/index.html')
-rw-r--r-- | files/pl/web/javascript/reference/global_objects/regexp/lastmatch/index.html | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/files/pl/web/javascript/reference/global_objects/regexp/lastmatch/index.html b/files/pl/web/javascript/reference/global_objects/regexp/lastmatch/index.html new file mode 100644 index 0000000000..f9f1c9a129 --- /dev/null +++ b/files/pl/web/javascript/reference/global_objects/regexp/lastmatch/index.html @@ -0,0 +1,55 @@ +--- +title: RegExp.lastMatch ($&) +slug: Web/JavaScript/Reference/Global_Objects/RegExp/lastMatch +translation_of: Web/JavaScript/Reference/Global_Objects/RegExp/lastMatch +original_slug: Web/JavaScript/Referencje/Obiekty/RegExp/lastMatch +--- +<div>{{JSRef}} {{non-standard_header}}</div> + +<p>Niestandardowa właściwość <strong>lastMatch</strong> jest właściwością statyczną, tylko do odczytu wyrażeń regularnych, który zawiera ostatnie dopasowane znaki. <code>RegExp.$&</code> jest aliasem tej właściwości.</p> + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox"><var>RegExp</var>.lastMatch +RegExp['$&'] +</pre> + +<h2 id="Description">Description</h2> + +<p>The <code>lastMatch</code> property is static, it is not a property of an individual regular expression object. Instead, you always use it as <code>RegExp.lastMatch</code> or <code>RegExp['$&'].</code></p> + +<p>The value of the <code>lastMatch</code> property is read-only and modified whenever a successful match is made.</p> + +<p>You can not use the shorthand alias with the dot property accessor (<code>RegExp.$&</code>), because the parser expects an expression with "&" in that case and a {{jsxref("SyntaxError")}} is thrown. Use the <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Property_Accessors">bracket notation for property access</a>.</p> + +<h2 id="Examples">Examples</h2> + +<h3 id="Using_lastMatch_and">Using <code>lastMatch</code> and <code>$&</code></h3> + +<pre class="brush: js">var re = /hi/g; +re.test('hi there!'); +RegExp.lastMatch; // "hi" +RegExp['$&']; // "hi" +</pre> + +<h2 id="Specifications">Specifications</h2> + +<p>Niestandardowe. Nie jest częścią aktualnej specyfikacji.</p> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<div> + + +<p>{{Compat("javascript.builtins.RegExp.lastMatch")}}</p> +</div> + +<h2 id="See_also">See also</h2> + +<ul> + <li>{{non-standard_inline}} {{jsxref("RegExp.input", "RegExp.input ($_)")}}</li> + <li>{{non-standard_inline}} {{jsxref("RegExp.lastParen", "RegExp.lastParen ($+)")}}</li> + <li>{{non-standard_inline}} {{jsxref("RegExp.leftContext", "RegExp.leftContext ($`)")}}</li> + <li>{{non-standard_inline}} {{jsxref("RegExp.rightContext", "RegExp.rightContext ($')")}}</li> + <li>{{non-standard_inline}} {{jsxref("RegExp.n", "RegExp.$1-$9")}}</li> +</ul> |