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
587d7db9367417b2b2512ba7 Specify Exact Number of Matches 1 指定完全匹配数

Description

您可以使用大括号quantity specifiers的较低和较高数量的模式。有时您只需要特定数量的匹配。要指定一定数量的模式,只需在大括号之间放置一个数字。例如,要仅将单词"hah"与字母a匹配3次,您的正则表达式将为/ha{3}h/
让A4 =“haaaah”;
让A3 =“haaah”;
设A100 =“h”+“a”.repeat100+“h”;
let multipleHA = / ha {3} h /;
multipleHA.testA4; //返回false
multipleHA.testA3; //返回true
multipleHA.testA100; //返回false

Instructions

只有当它有四个字母m时才更改正则表达式timRegex以匹配单词"Timber"

Tests

tests:
  - text: 你的正则表达式应该使用大括号。
    testString: assert(timRegex.source.match(/{.*?}/).length > 0);
  - text: 你的正则表达式不应该与<code>&quot;Timber&quot;</code>匹配
    testString: assert(!timRegex.test("Timber"));
  - text: 你的正则表达式不应该匹配<code>&quot;Timmber&quot;</code>
    testString: assert(!timRegex.test("Timmber"));
  - text: 你的正则表达式不应该匹配<code>&quot;Timmmber&quot;</code>
    testString: assert(!timRegex.test("Timmmber"));
  - text: 你的正则表达式应该匹配<code>&quot;Timmmmber&quot;</code>
    testString: assert(timRegex.test("Timmmmber"));
  - text: 你的正则表达式不应该与30 <code>m</code>的<code>&quot;Timber&quot;</code>相匹配。
    testString: assert(!timRegex.test("Ti" + "m".repeat(30) + "ber"));

Challenge Seed

let timStr = "Timmmmber";
let timRegex = /change/; // Change this line
let result = timRegex.test(timStr);

Solution

// solution required