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

id, title, challengeType, videoUrl, localeTitle
id title challengeType videoUrl localeTitle
587d7db4367417b2b2512b93 Find More Than the First Match 1 找到比第一场比赛更多的东西

Description

到目前为止,您只能提取或搜索一次模式。
让testStr =“重复,重复,重复”;
让ourRegex = /重复/;
testStr.matchourRegex;
//返回[“重复”]
要多次搜索或提取模式,可以使用g标志。
let repeatRegex = / Repeat / g;
testStr.matchrepeatRegex;
//返回[“重复”,“重复”,“重复”]

Instructions

使用正则表达式starRegex ,找到并提取字符串twinkleStar "Twinkle"单词。 注意
你可以在你的正则表达式上有多个标志,比如/search/gi

Tests

tests:
  - text: 你的正则表达式<code>starRegex</code>应该使用全局标志<code>g</code>
    testString: assert(starRegex.flags.match(/g/).length == 1);
  - text: 你的正则表达式<code>starRegex</code>应该使用不区分大小写的标志<code>i</code>
    testString: assert(starRegex.flags.match(/i/).length == 1);
  - text: 您的匹配应匹配<code>&quot;Twinkle&quot;</code>一词的出现次数
    testString: assert(result.sort().join() == twinkleStar.match(/twinkle/gi).sort().join());
  - text: 您的匹配<code>result</code>应该包含两个元素。
    testString: assert(result.length == 2);

Challenge Seed

let twinkleStar = "Twinkle, twinkle, little star";
let starRegex = /change/; // Change this line
let result = twinkleStar; // Change this line

Solution

// solution required