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

1.8 KiB
Raw Blame History

id, title, challengeType, videoUrl, localeTitle
id title challengeType videoUrl localeTitle
587d7dba367417b2b2512ba8 Check for All or None 1 检查全部或无

Description

有时,您要搜索的模式可能包含可能存在或可能不存在的模式。但是,尽管如此,检查它们可能很重要。您可以指定可能存在带问号的元素, ? 。这将检查前一个元素中的零个或一个。您可以将此符号视为前一个元素是可选的。例如,美式英语和英式英语略有不同,您可以使用问号来匹配两种拼写。
让美国人=“颜色”;
让british =“color”;
让rainbowRegex = / colour /;
rainbowRegex.test美国; //返回true
rainbowRegex.test英国; //返回true

Instructions

更改正则表达式favRegex以匹配该单词的美国英语(收藏)和英国英语(收藏)版本。

Tests

tests:
  - text: 你的正则表达式应该使用可选的符号, <code>?</code> 。
    testString: assert(favRegex.source.match(/\?/).length > 0);
  - text: 你的正则表达式应该匹配<code>&quot;favorite&quot;</code>
    testString: assert(favRegex.test("favorite"));
  - text: 你的正则表达式应该匹配<code>&quot;favourite&quot;</code>
    testString: assert(favRegex.test("favourite"));
  - text: 你的正则表达式不应该匹配<code>&quot;fav&quot;</code>
    testString: assert(!favRegex.test("fav"));

Challenge Seed

let favWord = "favorite";
let favRegex = /change/; // Change this line
let result = favRegex.test(favWord);

Solution

// solution required