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

2.2 KiB
Raw Blame History

id, title, challengeType, videoUrl, localeTitle
id title challengeType videoUrl localeTitle
587d7db8367417b2b2512ba3 Match Whitespace 1 匹配空白

Description

迄今为止的挑战包括匹配的字母和数字字母。您还可以匹配字母之间的空格或空格。您可以使用\s搜索空格,这是一个小写的s 。此模式不仅匹配空格,还匹配回车符,制表符,换页符和换行符。你可以认为它类似于字符类[ \r\t\f\n\v]
让whiteSpace =“空白。到处都是空白!”
让spaceRegex = / \ s / g;
whiteSpace.matchspaceRegex;
//返回[“”,“”]

Instructions

更改正则表达式countWhiteSpace以查找字符串中的多个空格字符。

Tests

tests:
  - text: 你的正则表达式应该使用全局标志。
    testString: assert(countWhiteSpace.global);
  - text: 你的正则表达式应该使用速记字符
    testString: assert(/\\s/.test(countWhiteSpace.source));
  - text: 你的正则表达式应该在<code>&quot;Men are from Mars and women are from Venus.&quot;</code>找到八个空格<code>&quot;Men are from Mars and women are from Venus.&quot;</code>
    testString: assert("Men are from Mars and women are from Venus.".match(countWhiteSpace).length == 8);
  - text: '你的正则表达式应该在<code>&quot;Space: the final frontier.&quot;</code>找到三个空格<code>&quot;Space: the final frontier.&quot;</code>'
    testString: 'assert("Space: the final frontier.".match(countWhiteSpace).length == 3);'
  - text: 您的正则表达式应该在<code>"MindYourPersonalSpace"</code>中找不到空格
    testString: assert("MindYourPersonalSpace".match(countWhiteSpace) == null);

Challenge Seed

let sample = "Whitespace is important in separating words";
let countWhiteSpace = /change/; // Change this line
let result = sample.match(countWhiteSpace);

Solution

// solution required