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/source/index.html | 109 +++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 files/zh-cn/web/javascript/reference/global_objects/regexp/source/index.html (limited to 'files/zh-cn/web/javascript/reference/global_objects/regexp/source') diff --git a/files/zh-cn/web/javascript/reference/global_objects/regexp/source/index.html b/files/zh-cn/web/javascript/reference/global_objects/regexp/source/index.html new file mode 100644 index 0000000000..8f526e39ca --- /dev/null +++ b/files/zh-cn/web/javascript/reference/global_objects/regexp/source/index.html @@ -0,0 +1,109 @@ +--- +title: RegExp.prototype.source +slug: Web/JavaScript/Reference/Global_Objects/RegExp/source +tags: + - JavaScript + - Property + - Prototype + - Reference + - RegExp + - Regular Expressions +translation_of: Web/JavaScript/Reference/Global_Objects/RegExp/source +--- +
{{JSRef("Global_Objects", "RegExp")}}
+ +

概述

+ +

source 属性返回一个值为当前正则表达式对象的模式文本的字符串,该字符串不会包含正则字面量两边的斜杠以及任何的标志字符。

+ +

示例

+ +
var regex = /fooBar/ig;
+
+console.log(regex.source); // "fooBar",不包含 /.../ 和 "ig"。
+
+ +

规范

+ + + + + + + + + + + + + + + + + + + + + + + + +
规范名称规范状态备注
ECMAScript 3rd Edition.Standardsource 是正则对象自身的数据属性
{{SpecName('ES5.1', '#sec-15.10.7.1', 'RegExp.prototype.source')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-get-regexp.prototype.source', 'RegExp.prototype.source')}}{{Spec2('ES6')}}source 成为了正则对象原型上的一个访问器属性
+ +

浏览器兼容性

+ +
{{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