* 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
2.6 KiB
2.6 KiB
id, title, challengeType, videoUrl, localeTitle
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
587d7db6367417b2b2512b9a | Match Characters that Occur Zero or More Times | 1 | 匹配出现零次或多次的字符 |
Description
+
号来查找出现一次或多次的字符。还有一个选项可以匹配出现零次或多次的字符。执行此操作的字符是asterisk
或star
asterisk
: *
。 让soccerWord =“gooooooooal!”;
让gPhrase =“直觉”;
让oPhrase =“越过月亮”;
let goRegex = / go * /;
soccerWord.match(goRegex); //返回[“goooooooo”]
gPhrase.match(goRegex); //返回[“g”]
oPhrase.match(goRegex); //返回null
Instructions
chewieRegex
使用的*
字符匹配所有上下"a"
中的字符chewieQuote
。你的正则表达式不需要标志,它不应该与任何其他引号相匹配。 Tests
tests:
- text: 您正则表达式<code>chewieRegex</code>应该使用<code>*</code>字符匹配零个或多个<code>a</code>字符。
testString: assert(/\*/.test(chewieRegex.source));
- text: 你的正则表达式<code>chewieRegex</code>应匹配16个字符。
testString: assert(result[0].length === 16);
- text: 你的正则表达式应该匹配<code>"Aaaaaaaaaaaaaaaa"</code> 。
testString: assert(result[0] === "Aaaaaaaaaaaaaaaa");
- text: '你的正则表达式不应该与<code>"He made a fair move. Screaming about it can't help you."</code>中的任何角色相匹配<code>"He made a fair move. Screaming about it can't help you."</code>'
testString: assert(!"He made a fair move. Screaming about it can\"t help you.".match(chewieRegex));
- text: '你的正则表达式不应该与<code>"Let him have it. It's not wise to upset a Wookiee."</code>中的任何角色相匹配<code>"Let him have it. It's not wise to upset a Wookiee."</code>'
testString: assert(!"Let him have it. It\"s not wise to upset a Wookiee.".match(chewieRegex));
Challenge Seed
let chewieQuote = "Aaaaaaaaaaaaaaaarrrgh!";
let chewieRegex = /change/; // Change this line
let result = chewieQuote.match(chewieRegex);
Solution
// solution required