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/leftcontext/index.html | 67 ++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 files/ja/web/javascript/reference/global_objects/regexp/leftcontext/index.html (limited to 'files/ja/web/javascript/reference/global_objects/regexp/leftcontext') diff --git a/files/ja/web/javascript/reference/global_objects/regexp/leftcontext/index.html b/files/ja/web/javascript/reference/global_objects/regexp/leftcontext/index.html new file mode 100644 index 0000000000..f97a676da6 --- /dev/null +++ b/files/ja/web/javascript/reference/global_objects/regexp/leftcontext/index.html @@ -0,0 +1,67 @@ +--- +title: RegExp.leftContext ($`) +slug: Web/JavaScript/Reference/Global_Objects/RegExp/leftContext +tags: + - JavaScript + - Non-standard + - Property + - Read-only + - Reference + - RegExp + - Regular Expressions +translation_of: Web/JavaScript/Reference/Global_Objects/RegExp/leftContext +--- +
{{JSRef}} {{non-standard_header}}
+ +

標準外の input プロパティは、正規表現の一致している文字列を含む静的プロパティです。 RegExp.$` はこのプロパティのエイリアスです。

+ +

解説

+ +

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

+ +

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

+ +

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

+ +

+ +

input と $` の使用

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

仕様書

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

ブラウザーの互換性

+ +
+ + +

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

+
+ +

関連情報

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