From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../global_objects/regexp/rightcontext/index.html | 67 ++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 files/ja/web/javascript/reference/global_objects/regexp/rightcontext/index.html (limited to 'files/ja/web/javascript/reference/global_objects/regexp/rightcontext') diff --git a/files/ja/web/javascript/reference/global_objects/regexp/rightcontext/index.html b/files/ja/web/javascript/reference/global_objects/regexp/rightcontext/index.html new file mode 100644 index 0000000000..755f4d434f --- /dev/null +++ b/files/ja/web/javascript/reference/global_objects/regexp/rightcontext/index.html @@ -0,0 +1,67 @@ +--- +title: RegExp.rightContext ($') +slug: Web/JavaScript/Reference/Global_Objects/RegExp/rightContext +tags: + - JavaScript + - Non-standard + - Property + - Read-only + - Reference + - RegExp + - Regular Expressions +translation_of: Web/JavaScript/Reference/Global_Objects/RegExp/rightContext +--- +
{{JSRef}} {{non-standard_header}}
+ +

標準外の rightContext プロパティは静的かつ読み取り専用の正規表現のプロパティで、最新の一致に続く部分文字列が入ります。 RegExp.$` はこのプロパティのエイリアスです。

+ +

解説

+ +

rightContext プロパティは静的プロパティです。個々の正規表現オブジェクトのプロパティではありません。常に、 RegExp.rightContext または RegExp["$'"] として使用してください。

+ +

rightContext プロパティの値は読み取り専用で、一致に成功するたびに変更されます。

+ +

ドットプロパティアクセサー (RegExp.$') で短縮エイリアスを使用することはできません。その場合、パーサーは文字列の開始をを期待して {{jsxref("SyntaxError")}} が発生します。プロパティへのアクセスにはブラケット表記法を使用してください。

+ +

+ +

rightContext と $' の使用

+ +
var re = /hello/g;
+re.test('hello world!');
+RegExp.rightContext; // " world!"
+RegExp["$'"];       // " world!"
+
+ +

仕様書

+ + + + + + + + + + + + +
仕様書
{{SpecName('Legacy RegExp features')}}
+ +

ブラウザーの互換性

+ +
+ + +

{{Compat("javascript.builtins.RegExp.rightContext")}}

+
+ +

関連情報

+ + -- cgit v1.2.3-54-g00ecf