aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/guide/regular_expressions
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/javascript/guide/regular_expressions')
-rw-r--r--files/zh-cn/web/javascript/guide/regular_expressions/assertions/index.html16
-rw-r--r--files/zh-cn/web/javascript/guide/regular_expressions/character_classes/index.html6
-rw-r--r--files/zh-cn/web/javascript/guide/regular_expressions/groups_and_ranges/index.html6
-rw-r--r--files/zh-cn/web/javascript/guide/regular_expressions/index.html38
-rw-r--r--files/zh-cn/web/javascript/guide/regular_expressions/quantifiers/index.html8
-rw-r--r--files/zh-cn/web/javascript/guide/regular_expressions/unicode_property_escapes/index.html10
6 files changed, 42 insertions, 42 deletions
diff --git a/files/zh-cn/web/javascript/guide/regular_expressions/assertions/index.html b/files/zh-cn/web/javascript/guide/regular_expressions/assertions/index.html
index b7468ef5be..0d3757acd6 100644
--- a/files/zh-cn/web/javascript/guide/regular_expressions/assertions/index.html
+++ b/files/zh-cn/web/javascript/guide/regular_expressions/assertions/index.html
@@ -140,7 +140,7 @@ translation_of: Web/JavaScript/Guide/Regular_Expressions/Assertions
<h3 id="一般边界类型概述示例">一般边界类型概述示例</h3>
-<pre class="notranslate">// 使用 正则表达式边界修复错误字符串
+<pre>// 使用 正则表达式边界修复错误字符串
buggyMultiline = `tey, ihe light-greon apple
tangs on ihe greon traa`;
@@ -164,7 +164,7 @@ console.log(4, fixedMultiline); // 修复 'greon' 不影响'on'.</pre>
<p>使用 <code>^</code>匹配输入的开头。在这个例子中,我们可以通过 /^A/ 正则表达式得到以A开头的水果。为了选择合适的水果,我们可以使用带有箭头函数的过滤方法.</p>
-<pre class="notranslate">let fruits = ["Apple", "Watermelon", "Orange", "Avocado", "Strawberry"];
+<pre>let fruits = ["Apple", "Watermelon", "Orange", "Avocado", "Strawberry"];
// 使用正则 /^A/ 选择以'A'开头的水果.
// 这里的 '^' 只有一种含义: 匹配输入的开头.
@@ -174,7 +174,7 @@ console.log(fruitsStartsWithA); // [ 'Apple', 'Avocado' ]</pre>
<p>在第二个示例中,^用于在输入的开始处匹配,以及在内部使用时用于创建否定或被补充的字符集 <a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Guide/Regular_Expressions/Groups_and_Ranges">组和范围</a>.</p>
-<pre class="notranslate">let fruits = ["Apple", "Watermelon", "Orange", "Avocado", "Strawberry"];
+<pre>let fruits = ["Apple", "Watermelon", "Orange", "Avocado", "Strawberry"];
// 使用正则 /^[^A]/ 选择 不是以 ‘A’ 开头的水果
// 在这个例子中,“^” 控件符号表示两种含义:
@@ -187,7 +187,7 @@ console.log(fruitsStartsWithNotA); // [ 'Watermelon', 'Orange', 'Strawberry' ]</
<h3 id="匹配字边界">匹配字边界</h3>
-<pre class="notranslate">let fruitsWithDescription = ["Red apple", "Orange orange", "Green Avocado"];
+<pre>let fruitsWithDescription = ["Red apple", "Orange orange", "Green Avocado"];
// 选择包含以 “en” 或 “ed” 结尾的单词的描述:
let enEdSelection = fruitsWithDescription.filter(descr =&gt; /(en|ed)\b/.test(descr));
@@ -196,7 +196,7 @@ console.log(enEdSelection); // [ 'Red apple', 'Green Avocado' ]</pre>
<h3 id="向前断言">向前断言</h3>
-<pre class="notranslate">// JS 向前断言 x(?=y) 匹配被 y 跟随的 x
+<pre>// JS 向前断言 x(?=y) 匹配被 y 跟随的 x
let regex = /First(?= test)/g;
@@ -209,13 +209,13 @@ console.log('This is a First peach in a month.'.match(regex)); // null</pre>
<p>例如, <code>/\d+(?!\.)/</code> 匹配没有被小数点跟随且至少有一位的数字。 <code>/\d+(?!\.)/.exec('3.141')</code> 匹配 "141" 而不是 "3" </p>
-<pre class="notranslate">console.log(/\d+(?!\.)/g.exec('3.141')); // [ '141', index: 2, input: '3.141' ]</pre>
+<pre>console.log(/\d+(?!\.)/g.exec('3.141')); // [ '141', index: 2, input: '3.141' ]</pre>
<h3 id="不同含义的!:断言和范围的组合用法">不同含义的'?!':断言和范围的组合用法</h3>
<p>不同含义的<code>?!</code> 结合使用 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Assertions">断言</a>  <code>/x(?!y)/ </code>和  <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Groups_and_Ranges">范围</a> <code>[^?!]</code>.</p>
-<pre class="notranslate">let orangeNotLemon = "Do you want to have an orange? Yes, I do not want to have a lemon!";
+<pre>let orangeNotLemon = "Do you want to have an orange? Yes, I do not want to have a lemon!";
let selectNotLemonRegex = /[^?!]+have(?! a lemon)[^?!]+[?!]/gi
console.log(orangeNotLemon.match(selectNotLemonRegex)); // [ 'Do you want to have an orange?' ]
@@ -225,7 +225,7 @@ console.log(orangeNotLemon.match(selectNotOrangeRegex)); // [ ' Yes, I do not wa
<h3 id="向后断言">向后断言</h3>
-<pre class="notranslate">let oranges = ['ripe orange A ', 'green orange B', 'ripe orange C',];
+<pre>let oranges = ['ripe orange A ', 'green orange B', 'ripe orange C',];
let ripe_oranges = oranges.filter( fruit =&gt; fruit.match(/(?&lt;=ripe )orange/));
console.log(ripe_oranges); // [ 'ripe orange A ', 'ripe orange C' ]</pre>
diff --git a/files/zh-cn/web/javascript/guide/regular_expressions/character_classes/index.html b/files/zh-cn/web/javascript/guide/regular_expressions/character_classes/index.html
index 26b1f4ee4a..80f9181f89 100644
--- a/files/zh-cn/web/javascript/guide/regular_expressions/character_classes/index.html
+++ b/files/zh-cn/web/javascript/guide/regular_expressions/character_classes/index.html
@@ -144,7 +144,7 @@ translation_of: Web/JavaScript/Guide/Regular_Expressions/Character_Classes
<h3 id="Looking_for_a_series_of_digits">Looking for a series of digits</h3>
-<pre class="brush: js notranslate">var randomData = "015 354 8787 687351 3512 8735";
+<pre class="brush: js">var randomData = "015 354 8787 687351 3512 8735";
var regexpFourDigits = /\b\d{4}\b/g;
// \b indicates a boundary (i.e. do not start matching in the middle of a word)
// \d{4} indicates a digit, four times
@@ -157,7 +157,7 @@ console.table(randomData.match(regexpFourDigits));
<h3 id="Looking_for_a_word_from_the_latin_alphabet_starting_with_A">Looking for a word (from the latin alphabet) starting with A</h3>
-<pre class="brush: js notranslate">var aliceExcerpt = "I’m sure I’m not Ada,’ she said, ‘for her hair goes in such long ringlets, and mine doesn’t go in ringlets at all.";
+<pre class="brush: js">var aliceExcerpt = "I’m sure I’m not Ada,’ she said, ‘for her hair goes in such long ringlets, and mine doesn’t go in ringlets at all.";
var regexpWordStartingWithA = /\b[aA]\w+/g;
// \b indicates a boundary (i.e. do not start matching in the middle of a word)
// [aA] indicates the letter a or A
@@ -171,7 +171,7 @@ console.table(aliceExcerpt.match(regexpWordStartingWithA));
<p>Instead of the Latin alphabet, we can use a range of Unicode characters to identify a word (thus being able to deal with text in other languages like Russian or Arabic). The "Basic Multilingual Plane" of Unicode contains most of the characters used around the world and we can use character classes and ranges to match words written with those characters.</p>
-<pre class="brush: js notranslate">var nonEnglishText = "Приключения Алисы в Стране чудес";
+<pre class="brush: js">var nonEnglishText = "Приключения Алисы в Стране чудес";
var regexpBMPWord = /([\u0000-\u0019\u0021-\uFFFF])+/gu;
// BMP goes through U+0000 to U+FFFF but space is U+0020
diff --git a/files/zh-cn/web/javascript/guide/regular_expressions/groups_and_ranges/index.html b/files/zh-cn/web/javascript/guide/regular_expressions/groups_and_ranges/index.html
index 9a73c9b8ef..8aac5048dc 100644
--- a/files/zh-cn/web/javascript/guide/regular_expressions/groups_and_ranges/index.html
+++ b/files/zh-cn/web/javascript/guide/regular_expressions/groups_and_ranges/index.html
@@ -94,7 +94,7 @@ translation_of: Web/JavaScript/Guide/Regular_Expressions/Groups_and_Ranges
<h3 id="计算元音数">计算元音数</h3>
-<pre class="brush: js notranslate">var aliceExcerpt = "There was a long silence after this, and Alice could only hear whispers now and then.";
+<pre class="brush: js">var aliceExcerpt = "There was a long silence after this, and Alice could only hear whispers now and then.";
var regexpVowels = /[aeiouy]/g;
console.log("Number of vowels:", aliceExcerpt.match(regexpVowels).length);
@@ -102,7 +102,7 @@ console.log("Number of vowels:", aliceExcerpt.match(regexpVowels).length);
<h3 id="使用_组">使用 组</h3>
-<pre class="brush: js notranslate">let personList = `First_Name: John, Last_Name: Doe
+<pre class="brush: js">let personList = `First_Name: John, Last_Name: Doe
First_Name: Jane, Last_Name: Smith`;
let regexpNames =  /First_Name: (\w+), Last_Name: (\w+)/mg;
@@ -114,7 +114,7 @@ do {
<h3 id="使用命名组">使用命名组</h3>
-<pre class="brush: js notranslate">let users= `姓氏: 李, 名字: 雷
+<pre class="brush: js">let users= `姓氏: 李, 名字: 雷
姓氏: 韩, 名字: 梅梅`;
let regexpNames = /姓氏: (?&lt;first&gt;.+), 名字: (?&lt;last&gt;.+)/mg;
diff --git a/files/zh-cn/web/javascript/guide/regular_expressions/index.html b/files/zh-cn/web/javascript/guide/regular_expressions/index.html
index 4d88167c80..b38f643ced 100644
--- a/files/zh-cn/web/javascript/guide/regular_expressions/index.html
+++ b/files/zh-cn/web/javascript/guide/regular_expressions/index.html
@@ -21,14 +21,14 @@ translation_of: Web/JavaScript/Guide/Regular_Expressions
<p>使用一个正则表达式字面量,其由包含在斜杠之间的模式组成,如下所示:</p>
-<pre class="brush: js notranslate">var re = /ab+c/;
+<pre class="brush: js">var re = /ab+c/;
</pre>
<p>脚本加载后,正则表达式字面量就会被编译。当正则表达式保持不变时,使用此方法可获得更好的性能。</p>
<p>或者调用<code><a href="/zh-CN/docs/JavaScript/Reference/Global_Objects/RegExp" title="zh-CN/docs/JavaScript/Reference/Global Objects/RegExp">RegExp</a></code>对象的构造函数,如下所示:</p>
-<pre class="brush: js notranslate">var re = new RegExp("ab+c");
+<pre class="brush: js">var re = new RegExp("ab+c");
</pre>
<p>在脚本运行过程中,用构造函数创建的正则表达式会被编译。如果正则表达式将会改变,或者它将会从用户输入等来源中动态地产生,就需要使用构造函数来创建正则表达式。</p>
@@ -384,7 +384,7 @@ translation_of: Web/JavaScript/Guide/Regular_Expressions
<p>将用户输入转义为正则表达式中的一个字面字符串, 可以通过简单的替换来实现:</p>
-<pre class="brush: js notranslate">function escapeRegExp(string) {
+<pre class="brush: js">function escapeRegExp(string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&amp;");
//$&amp;表示整个被匹配的字符串
}</pre>
@@ -451,13 +451,13 @@ translation_of: Web/JavaScript/Guide/Regular_Expressions
<p>在接下来的例子中,脚本将使用exec方法在一个字符串中查找一个匹配。</p>
-<pre class="brush: js notranslate">var myRe = /d(b+)d/g;
+<pre class="brush: js">var myRe = /d(b+)d/g;
var myArray = myRe.exec("cdbbdbsbz");
</pre>
<p>如果你不需要访问正则表达式的属性,这个脚本通过另一个方法来创建myArray:</p>
-<pre class="brush: js notranslate">var myArray = /d(b+)d/g.exec("cdbbdbsbz");
+<pre class="brush: js">var myArray = /d(b+)d/g.exec("cdbbdbsbz");
// 和 "cdbbdbsbz".match(/d(b+)d/g); 相似。
// 但是 "cdbbdbsbz".match(/d(b+)d/g) 输出数组 [ "dbbd" ],
// 而 /d(b+)d/g.exec('cdbbdbsbz') 输出数组 [ "dbbd", "bb", index: 1, input: "cdbbdbsbz" ].
@@ -466,7 +466,7 @@ var myArray = myRe.exec("cdbbdbsbz");
<p>如果你想通过一个字符串构建正则表达式,那么这个脚本还有另一种方法:</p>
-<pre class="brush: js notranslate">var myRe = new RegExp("d(b+)d", "g");
+<pre class="brush: js">var myRe = new RegExp("d(b+)d", "g");
var myArray = myRe.exec("cdbbdbsbz");
</pre>
@@ -520,25 +520,25 @@ var myArray = myRe.exec("cdbbdbsbz");
<p>如这个例子中的第二种形式所示,你可以使用对象初始器创建一个正则表达式实例,但不分配给变量。如果你这样做,那么,每一次使用时都会创建一个新的正则表达式实例。因此,如果你不把正则表达式实例分配给一个变量,你以后将不能访问这个正则表达式实例的属性。例如,假如你有如下脚本:</p>
-<pre class="brush: js notranslate">var myRe = /d(b+)d/g;
+<pre class="brush: js">var myRe = /d(b+)d/g;
var myArray = myRe.exec("cdbbdbsbz");
console.log("The value of lastIndex is " + myRe.lastIndex);
</pre>
<p>这个脚本输出如下:</p>
-<pre class="notranslate">The value of lastIndex is 5
+<pre>The value of lastIndex is 5
</pre>
<p>然而,如果你有如下脚本:</p>
-<pre class="brush: js notranslate">var myArray = /d(b+)d/g.exec("cdbbdbsbz");
+<pre class="brush: js">var myArray = /d(b+)d/g.exec("cdbbdbsbz");
console.log("The value of lastIndex is " + /d(b+)d/g.lastIndex);
</pre>
<p>它显示为:</p>
-<pre class="notranslate">The value of lastIndex is 0
+<pre>The value of lastIndex is 0
</pre>
<p>当发生/d(b+)d/g使用两个不同状态的正则表达式对象,lastIndex属性会得到不同的值。如果你需要访问一个正则表达式的属性,则需要创建一个对象初始化生成器,你应该首先把它赋值给一个变量。</p>
@@ -551,7 +551,7 @@ console.log("The value of lastIndex is " + /d(b+)d/g.lastIndex);
<p>下面的脚本使用replace()方法来转换字符串中的单词。在匹配到的替换文本中,脚本使用替代的$ 1,$ 2表示第一个和第二个括号的子字符串匹配。</p>
-<pre class="brush: js notranslate">var re = /(\w+)\s(\w+)/;
+<pre class="brush: js">var re = /(\w+)\s(\w+)/;
var str = "John Smith";
var newstr = str.replace(re, "$2, $1");
console.log(newstr);
@@ -601,19 +601,19 @@ console.log(newstr);
<p>为了在正则表达式中包含标志,请使用以下语法:</p>
-<pre class="brush: js notranslate">var re = /pattern/flags;
+<pre class="brush: js">var re = /pattern/flags;
</pre>
<p>或者</p>
-<pre class="brush: js notranslate">var re = new RegExp("pattern", "flags");
+<pre class="brush: js">var re = new RegExp("pattern", "flags");
</pre>
<p>值得注意的是,标志是一个正则表达式的一部分,它们在接下来的时间将不能添加或删除。</p>
<p>例如,re = /\w+\s/g 将创建一个查找一个或多个字符后有一个空格的正则表达式,或者组合起来像此要求的字符串。</p>
-<pre class="brush: js notranslate">var re = /\w+\s/g;
+<pre class="brush: js">var re = /\w+\s/g;
var str = "fee fi fo fum";
var myArray = str.match(re);
console.log(myArray);
@@ -623,19 +623,19 @@ console.log(myArray);
<p>这段代码将输出 ["fee ", "fi ", "fo "]。在这个例子中,你可以将:</p>
-<pre class="brush: js notranslate">var re = /\w+\s/g;
+<pre class="brush: js">var re = /\w+\s/g;
</pre>
<p>替换成:</p>
-<pre class="brush: js notranslate">var re = new RegExp("\\w+\\s", "g");
+<pre class="brush: js">var re = new RegExp("\\w+\\s", "g");
</pre>
<p>并且能获取到相同的结果。</p>
<p>使用<code>.exec()</code>方法时,与'<code>g</code>'标志关联的行为是不同的。 (“class”和“argument”的作用相反:在<code>.match()</code>的情况下,字符串类(或数据类型)拥有该方法,而正则表达式只是一个参数,而在<code>.exec()</code>的情况下,它是拥有该方法的正则表达式,其中字符串是参数。对比<em><code>str.match(re)</code></em>与<em><code>re.exec(str)</code></em> ), '<code>g</code>'标志与<code>.exec()</code>方法一起使用获得迭代进展。</p>
-<pre class="brush: js notranslate">var xArray; while(xArray = re.exec(str)) console.log(xArray);
+<pre class="brush: js">var xArray; while(xArray = re.exec(str)) console.log(xArray);
// produces:
// ["fee ", index: 0, input: "fee fi fo fum"]
// ["fi ", index: 4, input: "fee fi fo fum"]
@@ -651,7 +651,7 @@ console.log(myArray);
<p>以下例子解释了正则表达式的构成和 <code>string.split()</code> 以及 <code>string.replace()</code>的用途。它会整理一个只有粗略格式的含有全名(名字首先出现)的输入字符串,这个字符串被空格、换行符和一个分号分隔。最终,它会颠倒名字顺序(姓氏首先出现)和list的类型。</p>
-<pre class="brush: js notranslate">// 下面这个姓名字符串包含了多个空格和制表符,
+<pre class="brush: js">// 下面这个姓名字符串包含了多个空格和制表符,
// 且在姓和名之间可能有多个空格和制表符。
var names = "Orange Trump ;Fred Barney; Helen Rigby ; Bill Abel ; Chris Hand ";
@@ -716,7 +716,7 @@ console.log(output.join("\n"));
<p>当用户按下 Enter 设置 RegExp.input,这些变化也能被激活。</p>
-<pre class="brush: html notranslate">&lt;!DOCTYPE html&gt;
+<pre class="brush: html">&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
diff --git a/files/zh-cn/web/javascript/guide/regular_expressions/quantifiers/index.html b/files/zh-cn/web/javascript/guide/regular_expressions/quantifiers/index.html
index d705953a69..1173553f2d 100644
--- a/files/zh-cn/web/javascript/guide/regular_expressions/quantifiers/index.html
+++ b/files/zh-cn/web/javascript/guide/regular_expressions/quantifiers/index.html
@@ -85,14 +85,14 @@ original_slug: Web/JavaScript/Guide/Regular_Expressions/量词
<h3 id="重复模式">重复模式</h3>
-<pre class="brush: js notranslate">var wordEndingWithAs = /\w+a+/;
+<pre class="brush: js">var wordEndingWithAs = /\w+a+/;
var delicateMessage = "This is Spartaaaaaaa";
console.table(delicateMessage.match(wordEndingWithAs)); // [ "Spartaaaaaaa" ]</pre>
<h3 id="计算字符集">计算字符集</h3>
-<pre class="brush: js notranslate">var singleLetterWord = /\b\w\b/g;
+<pre class="brush: js">var singleLetterWord = /\b\w\b/g;
var notSoLongWord = /\b\w{1,6}\b/g;
var loooongWord = /\b\w{13,}\b/g;
@@ -105,7 +105,7 @@ console.table(sentence.match(loooongWord)); // ["multiplication"]可选可
<h3 id="可选字符"> 可选字符</h3>
-<pre class="brush: js notranslate">var britishText = "He asked his neighbour a favour.";
+<pre class="brush: js">var britishText = "He asked his neighbour a favour.";
var americanText = "He asked his neighbor a favor.";
var regexpEnding = /\w+ou?r/g;
@@ -123,7 +123,7 @@ console.table(americanText.match(regexpEnding));
<h3 id="贪婪_与_非贪婪的">贪婪 与 非贪婪的</h3>
-<pre class="brush: js notranslate">var text = "I must be getting somewhere near the centre of the earth.";
+<pre class="brush: js">var text = "I must be getting somewhere near the centre of the earth.";
var greedyRegexp = /[\w ]+/;
// [\w ] a letter of the latin alphabet or a whitespace
// + one or several times
diff --git a/files/zh-cn/web/javascript/guide/regular_expressions/unicode_property_escapes/index.html b/files/zh-cn/web/javascript/guide/regular_expressions/unicode_property_escapes/index.html
index db7312bea4..973820343c 100644
--- a/files/zh-cn/web/javascript/guide/regular_expressions/unicode_property_escapes/index.html
+++ b/files/zh-cn/web/javascript/guide/regular_expressions/unicode_property_escapes/index.html
@@ -21,7 +21,7 @@ translation_of: Web/JavaScript/Guide/Regular_Expressions/Unicode_Property_Escape
<div class="hidden">The following section is also duplicated on <a href="/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Cheatsheet">this cheatsheet</a>. Do not forget to edit it as well, thanks!</div>
-<pre class="brush: js notranslate">// Non-binary 属性
+<pre class="brush: js">// Non-binary 属性
\p{<em>Unicode属性值</em>}
\p{<em>Unicode属性名</em>=<em>Unicode属性值</em>}
@@ -66,7 +66,7 @@ translation_of: Web/JavaScript/Guide/Regular_Expressions/Unicode_Property_Escape
<p>它们可匹配字母、数字、符号、标点符号、空格等等。一般类别详见 <a href="https://unicode.org/reports/tr18/#General_Category_Property">the Unicode specification</a>.</p>
-<pre class="brush: js notranslate">// finding all the letters of a text
+<pre class="brush: js">// finding all the letters of a text
let story = "It’s the Cheshire Cat: now I shall have somebody to talk to.";
// Most explicit form
@@ -88,7 +88,7 @@ story.match(/\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}/gu);
<p>比如,<code>A</code> 属于 <code>拉丁文</code>,<code>ε</code> 属于<code>希腊(Greek)</code>文。</p>
-<pre class="brush: js notranslate">let mixedCharacters = "aεЛ";
+<pre class="brush: js">let mixedCharacters = "aεЛ";
// Using the canonical "long" name of the script
mixedCharacters.match(/\p{Script=Latin}/u); // a
@@ -104,7 +104,7 @@ mixedCharacters.match(/\p{Sc=Cyrillic}/u); // Л
<p>某字符用于多种文字时,<code>Script</code> 优先匹配最主要使用那个字符的文字。如果想要根据非主要的文字进行匹配,我们可以使用 <code>Script_Extensions</code> 属性 (简写为<code>Scx</code>).</p>
-<pre class="brush: js notranslate">// ٢ is the digit 2 in Arabic-Indic notation
+<pre class="brush: js">// ٢ is the digit 2 in Arabic-Indic notation
// while it is predominantly written within the Arabic script
// it can also be written in the Thaana script
@@ -121,7 +121,7 @@ mixedCharacters.match(/\p{Sc=Cyrillic}/u); // Л
<p>Unicode 属性转义 categories 包含更多字符, <code>\p{Letter}</code> 或 <code>\p{Number}</code> 将会适用于任何文字。</p>
-<pre class="brush: js notranslate">// Trying to use ranges to avoid \w limitations:
+<pre class="brush: js">// Trying to use ranges to avoid \w limitations:
const nonEnglishText = "Приключения Алисы в Стране чудес";
const regexpBMPWord = /([\u0000-\u0019\u0021-\uFFFF])+/gu;