aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/javascript/reference/global_objects/regexp/hasindices
diff options
context:
space:
mode:
authorMasahiro FUJIMOTO <mfujimot@gmail.com>2021-08-26 01:31:01 +0900
committerGitHub <noreply@github.com>2021-08-26 01:31:01 +0900
commitce37d8bfd5b7aef8a088babfa2bc2ff63c79ed21 (patch)
tree79df612988624ab77852e48b528435b1aff22c28 /files/ja/web/javascript/reference/global_objects/regexp/hasindices
parentceaac49d854e31a1ffc0f0ce929de408b801337b (diff)
downloadtranslated-content-ce37d8bfd5b7aef8a088babfa2bc2ff63c79ed21.tar.gz
translated-content-ce37d8bfd5b7aef8a088babfa2bc2ff63c79ed21.tar.bz2
translated-content-ce37d8bfd5b7aef8a088babfa2bc2ff63c79ed21.zip
JavaScript の RegExp/lastIndex を更新 (#2114)
- RegExp/lastIndex を Markdown 化し、2021/08/17 時点の英語版に同期 - RegExp/hasIndices を新規翻訳
Diffstat (limited to 'files/ja/web/javascript/reference/global_objects/regexp/hasindices')
-rw-r--r--files/ja/web/javascript/reference/global_objects/regexp/hasindices/index.md70
1 files changed, 70 insertions, 0 deletions
diff --git a/files/ja/web/javascript/reference/global_objects/regexp/hasindices/index.md b/files/ja/web/javascript/reference/global_objects/regexp/hasindices/index.md
new file mode 100644
index 0000000000..6b8788a480
--- /dev/null
+++ b/files/ja/web/javascript/reference/global_objects/regexp/hasindices/index.md
@@ -0,0 +1,70 @@
+---
+title: RegExp.prototype.hasIndices
+slug: Web/JavaScript/Reference/Global_Objects/RegExp/hasIndices
+tags:
+ - Draft
+ - JavaScript
+ - Property
+ - Prototype
+ - Reference
+ - RegExp
+ - Regular Expressions
+browser-compat: javascript.builtins.RegExp.hasIndices
+translation_of: Web/JavaScript/Reference/Global_Objects/RegExp/hasIndices
+---
+{{JSRef}}
+
+**`hasIndices`** プロパティは、その正規表現で "`d`" フラグが使用されたかどうかを示します。 `hasIndices` はそれぞれの正規表現インスタンスの読み取り専用プロパティです。
+
+{{EmbedInteractiveExample("pages/js/regexp-prototype-hasindices.html")}}
+
+{{JS_Property_Attributes(0, 0, 1)}}
+
+## 解説
+
+`hasIndices` の値は論理型であり、 "`d`" フラグが使用された場合は `true` になります。それ以外の場合は `false` になります。 "`d`" フラグは正規表現による一致の結果に、各キャプチャグループの部分文字列の開始と終了の位置を含めることを示します。
+
+このプロパティを直接変更することはできません。
+
+## 例
+
+### `hasIndices` の使用
+
+```js
+const str1 = 'foo bar foo';
+
+const regex1 = new RegExp('foo', 'gd');
+
+console.log(regex1.hasIndices); // 出力: true
+
+console.log(regex1.exec(str1).indices[0]); // 出力: Array [0, 3]
+console.log(regex1.exec(str1).indices[0]); // 出力: Array [8, 11]
+
+const str2 = 'foo bar foo';
+
+const regex2 = new RegExp('foo');
+
+console.log(regex2.hasIndices); // 出力: false
+
+console.log(regex2.exec(str2).indices); // 出力: undefined
+```
+
+## 仕様書
+
+{{Specifications}}
+
+## ブラウザーの互換性
+
+{{Compat}}
+
+## 関連情報
+
+- {{JSxRef("RegExp.lastIndex")}}
+- {{JSxRef("RegExp.prototype.exec()")}}
+- {{JSxRef("RegExp.prototype.dotAll")}}
+- {{JSxRef("RegExp.prototype.global")}}
+- {{JSxRef("RegExp.prototype.ignoreCase")}}
+- {{JSxRef("RegExp.prototype.multiline")}}
+- {{JSxRef("RegExp.prototype.source")}}
+- {{JSxRef("RegExp.prototype.sticky")}}
+- {{JSxRef("RegExp.prototype.unicode")}}