[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastMatch [Back]  [Original]

RegExp.lastMatch ($&) - JavaScript | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

RegExp.lastMatch ($&)

Deprecated

Avoid using this feature in new projects. The RegExp static properties may have unintended side effects. This feature may be a candidate for removal from web standards or browsers.

: . , , . , , , .

lastMatch . . RegExp.$&.

In this article

RegExp.lastMatch
RegExp['$&']

lastMatch , RegExp.lastMatch RegExp['$&'].

lastMatch .

"&" SyntaxError, (RegExp.$&) . (RegExp['$&']).

lastMatch $&

js
var re = /hi/g;
re.test("hi there!");
RegExp.lastMatch; // "hi"
RegExp["$&"]; // "hi"

. - .


Web Proxy Viewer  |  New URL  |  Original Page