Kristofer Koishigawa b3213fc892 fix(i18n): chinese test suite (#38220)
* fix: Chinese test suite

Add localeTiltes, descriptions, and adjust test text and testStrings to get the automated test suite working.

* fix: ran script, updated testStrings and solutions
2020-03-03 18:49:47 +05:30

3.0 KiB
Raw Blame History

id, title, challengeType, videoUrl, localeTitle
id title challengeType videoUrl localeTitle
587d7db7367417b2b2512b9f Match All Letters and Numbers 1 匹配所有字母和数字

Description

使用字符类,您可以使用[az]搜索字母表中的所有字母。这种字符类很常见,它有一个快捷方式,虽然它还包含一些额外的字符。 JavaScript中与字母表匹配的最接近的字符类是\w 。此快捷方式等于[A-Za-z0-9_] 。此字符类匹配大写和小写字母加数字。注意,此字符类还包括下划线字符( _ )。
让longHand = / [A-Za-z0-9 _] + /;
让shortHand = / \ w + /;
让数字=“42”;
let varNames =“important_var”;
longHand.test数字; //返回true
shortHand.test数字; //返回true
longHand.testvarNames; //返回true
shortHand.testvarNames; //返回true
这些快捷方式字符类也称为shorthand character classes

Instructions

使用速记字符类\w来计算各种引号和字符串中的字母数字字符数。

Tests

tests:
  - text: 你的正则表达式应该使用全局标志。
    testString: assert(alphabetRegexV2.global);
  - text: 你的正则表达式应该使用速记字符
    testString: assert(/\\w/.test(alphabetRegexV2.source));
  - text: 你的正则表达式应该在<code>&quot;The five boxing wizards jump quickly.&quot;</code>找到31个字母数字字符<code>&quot;The five boxing wizards jump quickly.&quot;</code>
    testString: assert("The five boxing wizards jump quickly.".match(alphabetRegexV2).length === 31);
  - text: 你的正则表达式应该在<code>&quot;Pack my box with five dozen liquor jugs.&quot;</code>找到32个字母数字字符<code>&quot;Pack my box with five dozen liquor jugs.&quot;</code>
    testString: assert("Pack my box with five dozen liquor jugs.".match(alphabetRegexV2).length === 32);
  - text: 你的正则表达式应该在<code>&quot;How vexingly quick daft zebras jump!&quot;</code>找到30个字母数字字符<code>&quot;How vexingly quick daft zebras jump!&quot;</code>
    testString: assert("How vexingly quick daft zebras jump!".match(alphabetRegexV2).length === 30);
  - text: 你的正则表达式应该在<code>&quot;123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.&quot;</code>找到36个字母数字字符<code>&quot;123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.&quot;</code>
    testString: assert("123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.".match(alphabetRegexV2).length === 36);

Challenge Seed

let quoteSample = "The five boxing wizards jump quickly.";
let alphabetRegexV2 = /change/; // Change this line
let result = quoteSample.match(alphabetRegexV2).length;

Solution

// solution required