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.4 KiB
Raw Blame History

id, title, challengeType, videoUrl, localeTitle
id title challengeType videoUrl localeTitle
587d7db9367417b2b2512ba6 Specify Only the Lower Number of Matches 1 仅指定较低的匹配数

Description

您可以使用大括号quantity specifiers的较低和较高数量的模式。有时您只想指定较低数量的模式而没有上限。要仅指定较少的模式数,请保留第一个数字后跟逗号。例如,要仅匹配字符串"hah"与出现至少3次的字母a ,您的正则表达式将是/ha{3,}h/
让A4 =“haaaah”;
让A2 =“哈哈”;
设A100 =“h”+“a”.repeat100+“h”;
let multipleA = / ha {3} h /;
multipleA.testA4; //返回true
multipleA.testA2; //返回false
multipleA.testA100; //返回true

Instructions

只有当它有四个或更多字母z时才更改正则表达式haRegex以匹配单词"Hazzah"

Tests

tests:
  - text: 你的正则表达式应该使用大括号。
    testString: assert(haRegex.source.match(/{.*?}/).length > 0);
  - text: 你的正则表达式不应该与<code>&quot;Hazzah&quot;</code>匹配
    testString: assert(!haRegex.test("Hazzah"));
  - text: 你的正则表达式不应该与<code>&quot;Hazzzah&quot;</code>匹配
    testString: assert(!haRegex.test("Hazzzah"));
  - text: 你的正则表达应该匹配<code>&quot;Hazzzzah&quot;</code>
    testString: assert("Hazzzzah".match(haRegex)[0].length === 8);
  - text: 你的正则表达应该匹配<code>&quot;Hazzzzzah&quot;</code>
    testString: assert("Hazzzzzah".match(haRegex)[0].length === 9);
  - text: 你的正则表达应该匹配<code>&quot;Hazzzzzzah&quot;</code>
    testString: assert("Hazzzzzzah".match(haRegex)[0].length === 10);
  - text: 你的正则表达式应该匹配<code>&quot;Hazzah&quot;</code>和30个<code>z</code> 。
    testString: assert("Hazzzzzzzzzzzzzzzzzzzzzzzzzzzzzzah".match(haRegex)[0].length === 34);

Challenge Seed

let haStr = "Hazzzzah";
let haRegex = /change/; // Change this line
let result = haRegex.test(haStr);

Solution

// solution required