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/input/index.html | 99 ++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 files/zh-cn/web/javascript/reference/global_objects/regexp/input/index.html (limited to 'files/zh-cn/web/javascript/reference/global_objects/regexp/input/index.html') diff --git a/files/zh-cn/web/javascript/reference/global_objects/regexp/input/index.html b/files/zh-cn/web/javascript/reference/global_objects/regexp/input/index.html new file mode 100644 index 0000000000..87b9ecb657 --- /dev/null +++ b/files/zh-cn/web/javascript/reference/global_objects/regexp/input/index.html @@ -0,0 +1,99 @@ +--- +title: RegExp.input ($_) +slug: Web/JavaScript/Reference/Global_Objects/RegExp/input +translation_of: Web/JavaScript/Reference/Global_Objects/RegExp/input +--- +
{{JSRef}} {{non-standard_header}}
+ +

input 非标准属性是正则表达式静态属性,含有正则表达式所匹配的字符串。RegExp.$_是这个属性的别名。

+ +

语法

+ +
RegExp.input
+RegExp.$_
+
+ +

描述

+ +

input 属性是静态的,并不是正则表达式独立对象的属性。反之,你应始终将其使用为 RegExp.input 或者 RegExp.$_。

+ +

当正则表达式上搜索的字符串发生改变,并且字符串匹配时,input 属性的值会修改。

+ +

示例

+ +

使用 input$_

+ +
var re = /hi/g;
+re.test('hi there!');
+RegExp.input;         // "hi there!"
+re.test('foo');       // 新测试,不匹配
+RegExp.$_;            // "hi there!"
+re.test('hi world!'); // 新测试,匹配
+RegExp.$_;            // "hi world!"
+
+ +

规范

+ +

非标准。并不是任何现行规范的一部分。

+ +

浏览器兼容性

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +

另见

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