2019-04-21 11:50:48 +08:00

123 lines
5.4 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<article id="wikiArticle">
<div></div>
<p><strong><code>unicode</code></strong> 属性表明正则表达式带有"<code>u</code>" 标志。 <code>unicode</code> 是正则表达式独立实例的只读属性。</p>
<div><table class="standard-table">
<thead>
<tr>
<th class="header" colspan="2"><code>RegExp.prototype.unicode</code> 属性的属性特性:</th>
</tr>
</thead>
<tbody>
<tr>
<td>writable</td>
<td>false</td>
</tr>
<tr>
<td>enumerable</td>
<td>false</td>
</tr>
<tr>
<td>configurable</td>
<td>true</td>
</tr>
</tbody>
</table></div>
<h2 id="描述">描述</h2>
<p><code>unicode</code> 的值是 <a href="Reference/Boolean" title="此页面仍未被本地化, 期待您的翻译!"><code>Boolean</code></a>,并且如果使用了 "<code>u</code>" 标志则为 <code>true</code>;否则为 <code>false</code>。"<code>u</code>" 标志开启了多种 Unicode 相关的特性。使用 "u" 标志,任何 Unicode 代码点的转义都会被解释。</p>
<p>你不能直接修改这个属性,它是只读的。</p>
<h2 id="示例">示例</h2>
<h3 id="使用_unicode_属性">使用 <code>unicode</code> 属性</h3>
<pre><code class="language-javascript">var regex = new RegExp('\u{61}', 'u');
console.log(regex.unicode); // true
</code></pre>
<h2 id="规范">规范</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
<tr>
<td><a class="external" href="https://www.ecma-international.org/ecma-262/6.0/#sec-get-regexp.prototype.unicode" hreflang="en" lang="en" rel="noopener">ECMAScript 2015 (6th Edition, ECMA-262)<br/><small lang="zh-CN">RegExp.prototype.unicode</small></a></td>
<td><span class="spec-Standard">Standard</span></td>
<td>初始定义。</td>
</tr>
<tr>
<td><a class="external" href="https://tc39.github.io/ecma262/#sec-get-regexp.prototype.unicode" hreflang="en" lang="en" rel="noopener">ECMAScript Latest Draft (ECMA-262)<br/><small lang="zh-CN">RegExp.prototype.unicode</small></a></td>
<td><span class="spec-Draft">Draft</span></td>
<td> </td>
</tr>
</tbody>
</table>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
<div><div class="blockIndicator warning"><strong><a class="external" href="https://github.com/mdn/browser-compat-data" rel="noopener">We're converting our compatibility data into a machine-readable JSON format</a></strong>.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
<strong><a class="new" href="/zh-CN/docs/MDN/Contribute/Structures/Compatibility_tables" rel="nofollow">Find out how you can help!</a></strong></div>
<div class="htab">
<a id="AutoCompatibilityTable" name="AutoCompatibilityTable"></a>
<ul>
<li class="selected"><a>Desktop</a></li>
<li><a>Mobile</a></li>
</ul>
</div></div>
<div id="compat-desktop">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Chrome</th>
<th>Edge</th>
<th>Firefox (Gecko)</th>
<th>Internet Explorer</th>
<th>Opera</th>
<th>Safari</th>
</tr>
<tr>
<td>Basic support</td>
<td>50</td>
<td>12 (case folding 13)</td>
<td><a href="/en-US/Firefox/Releases/46" title="Released on 2016-04-26.">46</a> (46)</td>
<td><span style="color: #f00;">未实现</span></td>
<td>37</td>
<td>10</td>
</tr>
</tbody>
</table>
</div>
<div id="compat-mobile">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Android</th>
<th>Chrome for Android</th>
<th>Firefox Mobile (Gecko)</th>
<th>IE Mobile</th>
<th>Opera Mobile</th>
<th>Safari Mobile</th>
</tr>
<tr>
<td>Basic support</td>
<td><span style="color: #f00;">未实现</span></td>
<td>50</td>
<td>46.0 (46)</td>
<td><span style="color: #f00;">未实现</span></td>
<td><span style="color: #888;" title="Please update this with the earliest version of support.">(Yes)</span></td>
<td>10</td>
</tr>
</tbody>
</table>
</div>
<h2 id="另见">另见</h2>
<ul>
<li><a href="Reference/Global_Objects/RegExp/lastIndex" title="lastIndex 是正则表达式的一个可读可写的整型属性用来指定下一次匹配的起始索引。"><code>RegExp.lastIndex</code></a></li>
<li><a href="Reference/Global_Objects/RegExp/global" title='global 属性表明正则表达式是否使用了 "g" 标志。global 是一个正则表达式实例的只读属性。'><code>RegExp.prototype.global</code></a></li>
<li><a href="Reference/Global_Objects/RegExp/ignoreCase" title='ignoreCase 属性表明正则表达式是否使用了 "i" 标志。ignoreCase 是正则表达式实例的只读属性。'><code>RegExp.prototype.ignoreCase</code></a></li>
<li><a href="Reference/Global_Objects/RegExp/multiline" title='multiline 属性表明正则表达式是否使用了 "m" 标志。multiline 是正则表达式实例的一个只读属性。'><code>RegExp.prototype.multiline</code></a></li>
<li><a href="Reference/Global_Objects/RegExp/source" title="source 属性返回一个值为当前正则表达式对象的模式文本的字符串,该字符串不会包含正则字面量两边的斜杠以及任何的标志字符。"><code>RegExp.prototype.source</code></a></li>
<li><a href="Reference/Global_Objects/RegExp/sticky" title="sticky 属性反映了搜索是否具有粘性 仅从正则表达式的 lastIndex 属性表示的索引处搜索 。sticky 是正则表达式对象的只读属性。"><code>RegExp.prototype.sticky</code></a></li>
</ul>
</article>