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

id, title, challengeType, videoUrl, localeTitle
id title challengeType videoUrl localeTitle
587d7db7367417b2b2512b9d Match Beginning String Patterns 1 匹配开始字符串模式

Description

先前的挑战表明,正则表达式可用于寻找许多匹配。它们还用于搜索字符串中特定位置的模式。在之前的挑战中,您使用character set内的caret符( ^ )来创建[^thingsThatWillNotBeMatched]形式的negated character set 。在character set caret用于在字符串的开头搜索模式。
让firstString =“Ricky是第一个可以找到。”;
让firstRegex = / ^ Ricky /;
firstRegex.testfirstString;
//返回true
让notFirst =“你现在找不到Ricky了。”;
firstRegex.testnotFirst;
//返回false

Instructions

使用正则表达式中的caret只能在字符串rickyAndCal的开头找到"Cal"

Tests

tests:
  - text: 你的正则表达式应该用大写字母搜索<code>&quot;Cal&quot;</code> 。
    testString: assert(calRegex.source == "^Cal");
  - text: 你的正则表达式不应该使用任何标志。
    testString: assert(calRegex.flags == "");
  - text: 你的正则表达式应该匹配字符串开头的<code>&quot;Cal&quot;</code> 。
    testString: assert(calRegex.test("Cal and Ricky both like racing."));
  - text: 您的正则表达式不应与字符串中间的<code>&quot;Cal&quot;</code>匹配。
    testString: assert(!calRegex.test("Ricky and Cal both like racing."));

Challenge Seed

let rickyAndCal = "Cal and Ricky both like racing.";
let calRegex = /change/; // Change this line
let result = calRegex.test(rickyAndCal);

Solution

// solution required