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
This commit is contained in:
Kristofer Koishigawa
2020-02-18 01:40:55 +09:00
committed by Mrugesh Mohapatra
parent 6a7a7e6d7d
commit b3213fc892
1264 changed files with 5635 additions and 4331 deletions

View File

@ -18,13 +18,13 @@ localeTitle: 检查全部或无
```yml
tests:
- text: 你的正则表达式应该使用可选的符号, <code>?</code> 。
testString: 'assert(favRegex.source.match(/\?/).length > 0, "Your regex should use the optional symbol, <code>?</code>.");'
testString: assert(favRegex.source.match(/\?/).length > 0);
- text: 你的正则表达式应该匹配<code>&quot;favorite&quot;</code>
testString: 'assert(favRegex.test("favorite"), "Your regex should match <code>"favorite"</code>");'
testString: assert(favRegex.test("favorite"));
- text: 你的正则表达式应该匹配<code>&quot;favourite&quot;</code>
testString: 'assert(favRegex.test("favourite"), "Your regex should match <code>"favourite"</code>");'
testString: assert(favRegex.test("favourite"));
- text: 你的正则表达式不应该匹配<code>&quot;fav&quot;</code>
testString: 'assert(!favRegex.test("fav"), "Your regex should not match <code>"fav"</code>");'
testString: assert(!favRegex.test("fav"));
```

View File

@ -18,11 +18,11 @@ localeTitle: 提取匹配
```yml
tests:
- text: <code>result</code>应该有单词<code>coding</code>
testString: 'assert(result.join() === "coding", "The <code>result</code> should have the word <code>coding</code>");'
testString: assert(result.join() === "coding");
- text: 你的regex <code>codingRegex</code>应该搜索<code>coding</code>
testString: 'assert(codingRegex.source === "coding", "Your regex <code>codingRegex</code> should search for <code>coding</code>");'
testString: assert(codingRegex.source === "coding");
- text: 您应该使用<code>.match()</code>方法。
testString: 'assert(code.match(/\.match\(.*\)/), "You should use the <code>.match()</code> method.");'
testString: assert(code.match(/\.match\(.*\)/));
```

View File

@ -18,13 +18,13 @@ localeTitle: 找到比第一场比赛更多的东西
```yml
tests:
- text: 你的正则表达式<code>starRegex</code>应该使用全局标志<code>g</code>
testString: 'assert(starRegex.flags.match(/g/).length == 1, "Your regex <code>starRegex</code> should use the global flag <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, "Your regex <code>starRegex</code> should use the case insensitive flag <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(), "Your match should match both occurrences of the word <code>"Twinkle"</code>");'
testString: assert(result.sort().join() == twinkleStar.match(/twinkle/gi).sort().join());
- text: 您的匹配<code>result</code>应该包含两个元素。
testString: 'assert(result.length == 2, "Your match <code>result</code> should have two elements in it.");'
testString: assert(result.length == 2);
```

View File

@ -18,19 +18,19 @@ localeTitle: 在狩猎中找到一个或多个罪犯
```yml
tests:
- text: 您正则表达式应该匹配<code>one</code>犯罪(“ <code>C</code>中”), <code>&quot;C&quot;</code>
testString: 'assert("C".match(reCriminals) && "C".match(reCriminals)[0] == "C", "Your regex should match <code>one</code> criminal ("<code>C</code>") in <code>"C"</code>");'
testString: assert('C'.match(reCriminals) && 'C'.match(reCriminals)[0] == 'C');
- text: 您正则表达式应该匹配<code>two</code>罪犯(“ <code>CC</code>中”) <code>&quot;CC&quot;</code>
testString: 'assert("CC".match(reCriminals) && "CC".match(reCriminals)[0] == "CC", "Your regex should match <code>two</code> criminals ("<code>CC</code>") in <code>"CC"</code>");'
testString: assert('CC'.match(reCriminals) && 'CC'.match(reCriminals)[0] == 'CC');
- text: 你的正则表达式应匹配<code>&quot;P1P5P4CCCP2P6P3&quot;</code>中的<code>three</code>罪犯(“ <code>CCC</code> ”)
testString: 'assert("P1P5P4CCCP2P6P3".match(reCriminals) && "P1P5P4CCCP2P6P3".match(reCriminals)[0] == "CCC", "Your regex should match <code>three</code> criminals ("<code>CCC</code>") in <code>"P1P5P4CCCP2P6P3"</code>");'
testString: assert('P1P5P4CCCP2P6P3'.match(reCriminals) && 'P1P5P4CCCP2P6P3'.match(reCriminals)[0] == 'CCC');
- text: 你的正则表达式应匹配<code>&quot;P6P2P7P4P5CCCCCP3P1&quot;</code>中的<code>five</code>罪犯(“ <code>CCCCC</code> ”)
testString: 'assert("P6P2P7P4P5CCCCCP3P1".match(reCriminals) && "P6P2P7P4P5CCCCCP3P1".match(reCriminals)[0] == "CCCCC", "Your regex should match <code>five</code> criminals ("<code>CCCCC</code>") in <code>"P6P2P7P4P5CCCCCP3P1"</code>");'
testString: assert('P6P2P7P4P5CCCCCP3P1'.match(reCriminals) && 'P6P2P7P4P5CCCCCP3P1'.match(reCriminals)[0] == 'CCCCC');
- text: 你的正则表达式不应该匹配<code>&quot;&quot;</code>中的任何罪犯
testString: 'assert(!reCriminals.test(""), "Your regex should not match any criminals in <code>""</code>");'
testString: assert(!reCriminals.test(''));
- text: 你的正则表达式不应该匹配<code>&quot;P1P2P3&quot;</code>中的任何罪犯
testString: 'assert(!reCriminals.test("P1P2P3"), "Your regex should not match any criminals in <code>"P1P2P3"</code>");'
testString: assert(!reCriminals.test('P1P2P3'));
- text: 您正则表达式应该与<code>fifty</code>的罪犯(“ <code>CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC</code>中”) <code>&quot;P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3&quot;</code> 。
testString: 'assert("P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3".match(reCriminals) && "P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3".match(reCriminals)[0] == "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC", "Your regex should match <code>fifty</code> criminals ("<code>CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC</code>") in <code>"P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3"</code>.");'
testString: assert('P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3'.match(reCriminals) && 'P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3'.match(reCriminals)[0] == "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC");
```

View File

@ -18,25 +18,25 @@ localeTitle: 匹配时忽略大小写
```yml
tests:
- text: 你的正则表达式应该与<code>freeCodeCamp</code>匹配
testString: 'assert(fccRegex.test("freeCodeCamp"), "Your regex should match <code>freeCodeCamp</code>");'
testString: assert(fccRegex.test('freeCodeCamp'));
- text: 你的正则表达式应该与<code>FreeCodeCamp</code>匹配
testString: 'assert(fccRegex.test("FreeCodeCamp"), "Your regex should match <code>FreeCodeCamp</code>");'
testString: assert(fccRegex.test('FreeCodeCamp'));
- text: 你的正则表达式应该与<code>FreecodeCamp</code>匹配
testString: 'assert(fccRegex.test("FreecodeCamp"), "Your regex should match <code>FreecodeCamp</code>");'
testString: assert(fccRegex.test('FreecodeCamp'));
- text: 你的正则表达式应该与<code>FreeCodecamp</code>匹配
testString: 'assert(fccRegex.test("FreeCodecamp"), "Your regex should match <code>FreeCodecamp</code>");'
testString: assert(fccRegex.test('FreeCodecamp'));
- text: 你的正则表达式不应该与<code>Free Code Camp</code>不匹配
testString: 'assert(!fccRegex.test("Free Code Camp"), "Your regex should not match <code>Free Code Camp</code>");'
testString: assert(!fccRegex.test('Free Code Camp'));
- text: 你的正则表达式应该与<code>FreeCOdeCamp</code>匹配
testString: 'assert(fccRegex.test("FreeCOdeCamp"), "Your regex should match <code>FreeCOdeCamp</code>");'
testString: assert(fccRegex.test('FreeCOdeCamp'));
- text: 你的正则表达式不应该与<code>FCC</code>匹配
testString: 'assert(!fccRegex.test("FCC"), "Your regex should not match <code>FCC</code>");'
testString: assert(!fccRegex.test('FCC'));
- text: 你的正则表达式应该与<code>FrEeCoDeCamp</code>匹配
testString: 'assert(fccRegex.test("FrEeCoDeCamp"), "Your regex should match <code>FrEeCoDeCamp</code>");'
testString: assert(fccRegex.test('FrEeCoDeCamp'));
- text: 你的正则表达式应该与<code>FrEeCodECamp</code>匹配
testString: 'assert(fccRegex.test("FrEeCodECamp"), "Your regex should match <code>FrEeCodECamp</code>");'
testString: assert(fccRegex.test('FrEeCodECamp'));
- text: 你的正则表达式应该与<code>FReeCodeCAmp</code>匹配
testString: 'assert(fccRegex.test("FReeCodeCAmp"), "Your regex should match <code>FReeCodeCAmp</code>");'
testString: assert(fccRegex.test('FReeCodeCAmp'));
```

View File

@ -18,19 +18,19 @@ localeTitle: 匹配具有不同可能性的文字字符串
```yml
tests:
- text: 你的正则表达式<code>petRegex</code>应该为字符串<code>&quot;John has a pet dog.&quot;</code>返回<code>true</code> <code>&quot;John has a pet dog.&quot;</code>
testString: 'assert(petRegex.test("John has a pet dog."), "Your regex <code>petRegex</code> should return <code>true</code> for the string <code>"John has a pet dog."</code>");'
testString: assert(petRegex.test('John has a pet dog.'));
- text: 你的正则表达式<code>petRegex</code>应该为字符串<code>&quot;Emma has a pet rock.&quot;</code>返回<code>false</code> <code>&quot;Emma has a pet rock.&quot;</code>
testString: 'assert(!petRegex.test("Emma has a pet rock."), "Your regex <code>petRegex</code> should return <code>false</code> for the string <code>"Emma has a pet rock."</code>");'
testString: assert(!petRegex.test('Emma has a pet rock.'));
- text: 你的正则表达式<code>petRegex</code>应该为字符串<code>&quot;Emma has a pet bird.&quot;</code>返回<code>true</code> <code>&quot;Emma has a pet bird.&quot;</code>
testString: 'assert(petRegex.test("Emma has a pet bird."), "Your regex <code>petRegex</code> should return <code>true</code> for the string <code>"Emma has a pet bird."</code>");'
testString: assert(petRegex.test('Emma has a pet bird.'));
- text: 你的正则表达式<code>petRegex</code>应该返回<code>true</code>为字符串<code>&quot;Liz has a pet cat.&quot;</code>
testString: 'assert(petRegex.test("Liz has a pet cat."), "Your regex <code>petRegex</code> should return <code>true</code> for the string <code>"Liz has a pet cat."</code>");'
testString: assert(petRegex.test('Liz has a pet cat.'));
- text: 你的正则表达式<code>petRegex</code>应该返回<code>false</code>为<code>&quot;Kara has a pet dolphin.&quot;</code>的字符串<code>&quot;Kara has a pet dolphin.&quot;</code>
testString: 'assert(!petRegex.test("Kara has a pet dolphin."), "Your regex <code>petRegex</code> should return <code>false</code> for the string <code>"Kara has a pet dolphin."</code>");'
testString: assert(!petRegex.test('Kara has a pet dolphin.'));
- text: 你的正则表达式<code>petRegex</code>应该返回<code>true</code>为字符串<code>&quot;Alice has a pet fish.&quot;</code>
testString: 'assert(petRegex.test("Alice has a pet fish."), "Your regex <code>petRegex</code> should return <code>true</code> for the string <code>"Alice has a pet fish."</code>");'
testString: assert(petRegex.test('Alice has a pet fish.'));
- text: 你的正则表达式<code>petRegex</code>应该返回<code>false</code>为字符串<code>&quot;Jimmy has a pet computer.&quot;</code>
testString: 'assert(!petRegex.test("Jimmy has a pet computer."), "Your regex <code>petRegex</code> should return <code>false</code> for the string <code>"Jimmy has a pet computer."</code>");'
testString: assert(!petRegex.test('Jimmy has a pet computer.'));
```

View File

@ -18,17 +18,17 @@ localeTitle: 匹配所有字母和数字
```yml
tests:
- text: 你的正则表达式应该使用全局标志。
testString: 'assert(alphabetRegexV2.global, "Your regex should use the global flag.");'
testString: assert(alphabetRegexV2.global);
- text: 你的正则表达式应该使用速记字符
testString: 'assert(/\\w/.test(alphabetRegexV2.source), "Your regex should use the shorthand character <code>\w</code> to match all characters which are alphanumeric.");'
testString: assert(/\\w/.test(alphabetRegexV2.source));
- text: 你的正则表达式应该在<code>&quot;The five boxing wizards jump quickly.&quot;</code>找到31个字母数字字符<code>&quot;The five boxing wizards jump quickly.&quot;</code>
testString: 'assert("The five boxing wizards jump quickly.".match(alphabetRegexV2).length === 31, "Your regex should find 31 alphanumeric characters in <code>"The five boxing wizards jump quickly."</code>");'
testString: assert("The five boxing wizards jump quickly.".match(alphabetRegexV2).length === 31);
- text: 你的正则表达式应该在<code>&quot;Pack my box with five dozen liquor jugs.&quot;</code>找到32个字母数字字符<code>&quot;Pack my box with five dozen liquor jugs.&quot;</code>
testString: 'assert("Pack my box with five dozen liquor jugs.".match(alphabetRegexV2).length === 32, "Your regex should find 32 alphanumeric characters in <code>"Pack my box with five dozen liquor jugs."</code>");'
testString: assert("Pack my box with five dozen liquor jugs.".match(alphabetRegexV2).length === 32);
- text: 你的正则表达式应该在<code>&quot;How vexingly quick daft zebras jump!&quot;</code>找到30个字母数字字符<code>&quot;How vexingly quick daft zebras jump!&quot;</code>
testString: 'assert("How vexingly quick daft zebras jump!".match(alphabetRegexV2).length === 30, "Your regex should find 30 alphanumeric characters in <code>"How vexingly quick daft zebras jump!"</code>");'
testString: assert("How vexingly quick daft zebras jump!".match(alphabetRegexV2).length === 30);
- text: 你的正则表达式应该在<code>&quot;123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.&quot;</code>找到36个字母数字字符<code>&quot;123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.&quot;</code>
testString: 'assert("123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.".match(alphabetRegexV2).length === 36, "Your regex should find 36 alphanumeric characters in <code>"123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ."</code>");'
testString: assert("123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.".match(alphabetRegexV2).length === 36);
```

View File

@ -18,21 +18,21 @@ localeTitle: 匹配所有非数字
```yml
tests:
- text: 您的正则表达式应使用快捷方式字符来匹配非数字字符
testString: 'assert(/\\D/.test(noNumRegex.source), "Your regex should use the shortcut character to match non-digit characters");'
testString: assert(/\\D/.test(noNumRegex.source));
- text: 你的正则表达式应该使用全局标志。
testString: 'assert(noNumRegex.global, "Your regex should use the global flag.");'
testString: assert(noNumRegex.global);
- text: 你的正则表达式应该在<code>&quot;9&quot;</code>找不到非数字。
testString: 'assert("9".match(noNumRegex) == null, "Your regex should find no non-digits in <code>"9"</code>.");'
testString: assert("9".match(noNumRegex) == null);
- text: 你的正则表达式应该在<code>&quot;Catch 22&quot;</code>找到6个非数字。
testString: 'assert("Catch 22".match(noNumRegex).length == 6, "Your regex should find 6 non-digits in <code>"Catch 22"</code>.");'
testString: assert("Catch 22".match(noNumRegex).length == 6);
- text: 你的正则表达式应该在<code>&quot;101 Dalmatians&quot;</code>找到11个非数字。
testString: 'assert("101 Dalmatians".match(noNumRegex).length == 11, "Your regex should find 11 non-digits in <code>"101 Dalmatians"</code>.");'
testString: assert("101 Dalmatians".match(noNumRegex).length == 11);
- text: '你的正则表达式应该在<code>&quot;One, Two, Three&quot;</code>找到15个非数字。'
testString: 'assert("One, Two, Three".match(noNumRegex).length == 15, "Your regex should find 15 non-digits in <code>"One, Two, Three"</code>.");'
testString: assert("One, Two, Three".match(noNumRegex).length == 15);
- text: 你的正则表达式应该在<code>&quot;21 Jump Street&quot;</code>找到12个非数字。
testString: 'assert("21 Jump Street".match(noNumRegex).length == 12, "Your regex should find 12 non-digits in <code>"21 Jump Street"</code>.");'
testString: assert("21 Jump Street".match(noNumRegex).length == 12);
- text: '你的正则表达式应该在<code>&quot;2001: A Space Odyssey&quot;</code>找到17个非数字。'
testString: 'assert("2001: A Space Odyssey".match(noNumRegex).length == 17, "Your regex should find 17 non-digits in <code>"2001: A Space Odyssey"</code>.");'
testString: 'assert("2001: A Space Odyssey".match(noNumRegex).length == 17);'
```

View File

@ -18,21 +18,21 @@ localeTitle: 匹配所有号码
```yml
tests:
- text: 您的正则表达式应使用快捷方式字符来匹配数字字符
testString: 'assert(/\\d/.test(numRegex.source), "Your regex should use the shortcut character to match digit characters");'
testString: assert(/\\d/.test(numRegex.source));
- text: 你的正则表达式应该使用全局标志。
testString: 'assert(numRegex.global, "Your regex should use the global flag.");'
testString: assert(numRegex.global);
- text: 你的正则表达式应该在<code>&quot;9&quot;</code>找到1位数。
testString: 'assert("9".match(numRegex).length == 1, "Your regex should find 1 digit in <code>"9"</code>.");'
testString: assert("9".match(numRegex).length == 1);
- text: 你的正则表达式应该在<code>&quot;Catch 22&quot;</code>找到2位数字。
testString: 'assert("Catch 22".match(numRegex).length == 2, "Your regex should find 2 digits in <code>"Catch 22"</code>.");'
testString: assert("Catch 22".match(numRegex).length == 2);
- text: 你的正则表达式应该在<code>&quot;101 Dalmatians&quot;</code>找到3位数字。
testString: 'assert("101 Dalmatians".match(numRegex).length == 3, "Your regex should find 3 digits in <code>"101 Dalmatians"</code>.");'
testString: assert("101 Dalmatians".match(numRegex).length == 3);
- text: '你的正则表达式应该在<code>&quot;One, Two, Three&quot;</code>找不到数字。'
testString: 'assert("One, Two, Three".match(numRegex) == null, "Your regex should find no digits in <code>"One, Two, Three"</code>.");'
testString: assert("One, Two, Three".match(numRegex) == null);
- text: 您的正则表达式应该在<code>&quot;21 Jump Street&quot;</code>找到2位数字。
testString: 'assert("21 Jump Street".match(numRegex).length == 2, "Your regex should find 2 digits in <code>"21 Jump Street"</code>.");'
testString: assert("21 Jump Street".match(numRegex).length == 2);
- text: '你的正则表达式应该在<code>&quot;2001: A Space Odyssey&quot;</code>找到4位数字。'
testString: 'assert("2001: A Space Odyssey".match(numRegex).length == 4, "Your regex should find 4 digits in <code>"2001: A Space Odyssey"</code>.");'
testString: 'assert("2001: A Space Odyssey".match(numRegex).length == 4);'
```

View File

@ -18,25 +18,25 @@ localeTitle: 匹配通配符期间的任何内容
```yml
tests:
- text: 您应该使用<code>.test()</code>方法。
testString: 'assert(code.match(/\.test\(.*\)/), "You should use the <code>.test()</code> method.");'
testString: assert(code.match(/\.test\(.*\)/));
- text: 您应该在正则表达式<code>unRegex</code>使用通配符
testString: 'assert(/\./.test(unRegex.source), "You should use the wildcard character in your regex <code>unRegex</code>");'
testString: assert(/\./.test(unRegex.source));
- text: 你的正则表达式<code>unRegex</code>应该匹配<code>&quot;run&quot;</code> <code>&quot;Let us go on a run.&quot;</code> <code>&quot;run&quot;</code>中的<code>&quot;run&quot;</code> <code>&quot;Let us go on a run.&quot;</code>
testString: 'assert(unRegex.test("Let us go on a run."), "Your regex <code>unRegex</code> should match <code>"run"</code> in <code>"Let us go on a run."</code>");'
testString: assert(unRegex.test("Let us go on a run."));
- text: 你的正则表达式<code>unRegex</code>应该与<code>&quot;sun&quot;</code> <code>&quot;The sun is out today.&quot;</code> <code>&quot;sun&quot;</code>中的<code>&quot;sun&quot;</code>匹配<code>&quot;The sun is out today.&quot;</code>
testString: 'assert(unRegex.test("The sun is out today."), "Your regex <code>unRegex</code> should match <code>"sun"</code> in <code>"The sun is out today."</code>");'
testString: assert(unRegex.test("The sun is out today."));
- text: 你的正则表达式<code>unRegex</code>应该与<code>&quot;fun&quot;</code> <code>&quot;Coding is a lot of fun.&quot;</code> <code>&quot;fun&quot;</code>中的<code>&quot;fun&quot;</code>匹配<code>&quot;Coding is a lot of fun.&quot;</code>
testString: 'assert(unRegex.test("Coding is a lot of fun."), "Your regex <code>unRegex</code> should match <code>"fun"</code> in <code>"Coding is a lot of fun."</code>");'
testString: assert(unRegex.test("Coding is a lot of fun."));
- text: 你的正则表达式<code>unRegex</code>应该匹配<code>&quot;pun&quot;</code> <code>&quot;Seven days without a pun makes one weak.&quot;</code> <code>&quot;pun&quot;</code> <code>&quot;Seven days without a pun makes one weak.&quot;</code>
testString: 'assert(unRegex.test("Seven days without a pun makes one weak."), "Your regex <code>unRegex</code> should match <code>"pun"</code> in <code>"Seven days without a pun makes one weak."</code>");'
testString: assert(unRegex.test("Seven days without a pun makes one weak."));
- text: 你的正则表达式<code>unRegex</code>应该与<code>&quot;nun&quot;</code> <code>&quot;One takes a vow to be a nun.&quot;</code> <code>&quot;nun&quot;</code>中的<code>&quot;nun&quot;</code>匹配<code>&quot;One takes a vow to be a nun.&quot;</code>
testString: 'assert(unRegex.test("One takes a vow to be a nun."), "Your regex <code>unRegex</code> should match <code>"nun"</code> in <code>"One takes a vow to be a nun."</code>");'
testString: assert(unRegex.test("One takes a vow to be a nun."));
- text: 你的正则表达式<code>unRegex</code>应该匹配<code>&quot;bun&quot;</code> <code>&quot;She got fired from the hot dog stand for putting her hair in a bun.&quot;</code> <code>&quot;bun&quot;</code>中的<code>&quot;bun&quot;</code> <code>&quot;She got fired from the hot dog stand for putting her hair in a bun.&quot;</code>
testString: 'assert(unRegex.test("She got fired from the hot dog stand for putting her hair in a bun."), "Your regex <code>unRegex</code> should match <code>"bun"</code> in <code>"She got fired from the hot dog stand for putting her hair in a bun."</code>");'
testString: assert(unRegex.test("She got fired from the hot dog stand for putting her hair in a bun."));
- text: 您的正则表达式<code>unRegex</code>不应与<code>&quot;There is a bug in my code.&quot;</code>匹配<code>&quot;There is a bug in my code.&quot;</code>
testString: 'assert(!unRegex.test("There is a bug in my code."), "Your regex <code>unRegex</code> should not match <code>"There is a bug in my code."</code>");'
testString: assert(!unRegex.test("There is a bug in my code."));
- text: 您的正则表达式<code>unRegex</code>不应该匹配<code>&quot;Catch me if you can.&quot;</code>
testString: 'assert(!unRegex.test("Can me if you can."), "Your regex <code>unRegex</code> should not match <code>"Catch me if you can."</code>");'
testString: assert(!unRegex.test("Can me if you can."));
```

View File

@ -18,13 +18,13 @@ localeTitle: 匹配开始字符串模式
```yml
tests:
- text: 你的正则表达式应该用大写字母搜索<code>&quot;Cal&quot;</code> 。
testString: 'assert(calRegex.source == "^Cal", "Your regex should search for <code>"Cal"</code> with a capital letter.");'
testString: assert(calRegex.source == "^Cal");
- text: 你的正则表达式不应该使用任何标志。
testString: 'assert(calRegex.flags == "", "Your regex should not use any flags.");'
testString: assert(calRegex.flags == "");
- text: 你的正则表达式应该匹配字符串开头的<code>&quot;Cal&quot;</code> 。
testString: 'assert(calRegex.test("Cal and Ricky both like racing."), "Your regex should match <code>"Cal"</code> at the beginning of the string.");'
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."), "Your regex should not match <code>"Cal"</code> in the middle of a string.");'
testString: assert(!calRegex.test("Ricky and Cal both like racing."));
```

View File

@ -18,11 +18,11 @@ localeTitle: 匹配出现一次或多次的字符
```yml
tests:
- text: 你的正则表达式<code>myRegex</code>应该使用<code>+</code>符号来匹配一个或多个<code>s</code>字符。
testString: 'assert(/\+/.test(myRegex.source), "Your regex <code>myRegex</code> should use the <code>+</code> sign to match one or more <code>s</code> characters.");'
testString: assert(/\+/.test(myRegex.source));
- text: 你的正则表达式<code>myRegex</code>应该匹配2个项目。
testString: 'assert(result.length == 2, "Your regex <code>myRegex</code> should match 2 items.");'
testString: assert(result.length == 2);
- text: <code>result</code>变量应该是一个包含两个匹配<code>&quot;ss&quot;</code>的数组
testString: 'assert(result[0] == "ss" && result[1] == "ss", "The <code>result</code> variable should be an array with two matches of <code>"ss"</code>");'
testString: assert(result[0] == 'ss' && result[1] == 'ss');
```

View File

@ -18,15 +18,15 @@ localeTitle: 匹配出现零次或多次的字符
```yml
tests:
- text: 您正则表达式<code>chewieRegex</code>应该使用<code>*</code>字符匹配零个或多个<code>a</code>字符。
testString: 'assert(/\*/.test(chewieRegex.source), "Your regex <code>chewieRegex</code> should use the <code>*</code> character to match zero or more <code>a</code> characters.");'
testString: assert(/\*/.test(chewieRegex.source));
- text: 你的正则表达式<code>chewieRegex</code>应匹配16个字符。
testString: 'assert(result[0].length === 16, "Your regex <code>chewieRegex</code> should match 16 characters.");'
testString: assert(result[0].length === 16);
- text: 你的正则表达式应该匹配<code>&quot;Aaaaaaaaaaaaaaaa&quot;</code> 。
testString: 'assert(result[0] === "Aaaaaaaaaaaaaaaa", "Your regex should match <code>"Aaaaaaaaaaaaaaaa"</code>.");'
testString: assert(result[0] === "Aaaaaaaaaaaaaaaa");
- text: '你的正则表达式不应该与<code>&quot;He made a fair move. Screaming about it can&#39;t help you.&quot;</code>中的任何角色相匹配<code>&quot;He made a fair move. Screaming about it can&#39;t help you.&quot;</code>'
testString: 'assert(!"He made a fair move. Screaming about it can\"t help you.".match(chewieRegex), "Your regex should not match any characters in <code>"He made a fair move. Screaming about it can&#39t help you."</code>");'
testString: assert(!"He made a fair move. Screaming about it can\"t help you.".match(chewieRegex));
- text: '你的正则表达式不应该与<code>&quot;Let him have it. It&#39;s not wise to upset a Wookiee.&quot;</code>中的任何角色相匹配<code>&quot;Let him have it. It&#39;s not wise to upset a Wookiee.&quot;</code>'
testString: 'assert(!"Let him have it. It\"s not wise to upset a Wookiee.".match(chewieRegex), "Your regex should not match any characters in <code>"Let him have it. It&#39s not wise to upset a Wookiee."</code>");'
testString: assert(!"Let him have it. It\"s not wise to upset a Wookiee.".match(chewieRegex));
```

View File

@ -18,11 +18,11 @@ localeTitle: 匹配结束字符串模式
```yml
tests:
- text: 您应该在正则表达式中使用美元符号<code>$</code> anchor搜索<code>&quot;caboose&quot;</code> 。
testString: 'assert(lastRegex.source == "caboose$", "You should search for <code>"caboose"</code> with the dollar sign <code>$</code> anchor in your regex.");'
testString: assert(lastRegex.source == "caboose$");
- text: 你的正则表达式不应该使用任何标志。
testString: 'assert(lastRegex.flags == "", "Your regex should not use any flags.");'
testString: assert(lastRegex.flags == "");
- text: 您应该在字符串末尾匹配<code>&quot;caboose&quot;</code> <code>&quot;The last car on a train is the caboose&quot;</code>
testString: 'assert(lastRegex.test("The last car on a train is the caboose"), "You should match <code>"caboose"</code> at the end of the string <code>"The last car on a train is the caboose"</code>");'
testString: assert(lastRegex.test("The last car on a train is the caboose"));
```

View File

@ -18,17 +18,17 @@ localeTitle: 匹配一切,但字母和数字
```yml
tests:
- text: 你的正则表达式应该使用全局标志。
testString: 'assert(nonAlphabetRegex.global, "Your regex should use the global flag.");'
testString: assert(nonAlphabetRegex.global);
- text: 你的正则表达式应该在<code>&quot;The five boxing wizards jump quickly.&quot;</code>找到6个非字母数字字符<code>&quot;The five boxing wizards jump quickly.&quot;</code> 。
testString: 'assert("The five boxing wizards jump quickly.".match(nonAlphabetRegex).length == 6, "Your regex should find 6 non-alphanumeric characters in <code>"The five boxing wizards jump quickly."</code>.");'
testString: assert("The five boxing wizards jump quickly.".match(nonAlphabetRegex).length == 6);
- text: 你的正则表达式应该使用速记字符。
testString: 'assert(/\\W/.test(nonAlphabetRegex.source), "Your regex should use the shorthand character to match characters which are non-alphanumeric.");'
testString: assert(/\\W/.test(nonAlphabetRegex.source));
- text: 你的正则表达式应该在<code>&quot;Pack my box with five dozen liquor jugs.&quot;</code>找到8个非字母数字字符<code>&quot;Pack my box with five dozen liquor jugs.&quot;</code>
testString: 'assert("Pack my box with five dozen liquor jugs.".match(nonAlphabetRegex).length == 8, "Your regex should find 8 non-alphanumeric characters in <code>"Pack my box with five dozen liquor jugs."</code>");'
testString: assert("Pack my box with five dozen liquor jugs.".match(nonAlphabetRegex).length == 8);
- text: 你的正则表达式应该在<code>&quot;How vexingly quick daft zebras jump!&quot;</code>找到6个非字母数字字符<code>&quot;How vexingly quick daft zebras jump!&quot;</code>
testString: 'assert("How vexingly quick daft zebras jump!".match(nonAlphabetRegex).length == 6, "Your regex should find 6 non-alphanumeric characters in <code>"How vexingly quick daft zebras jump!"</code>");'
testString: assert("How vexingly quick daft zebras jump!".match(nonAlphabetRegex).length == 6);
- text: 你的正则表达式应该在<code>&quot;123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.&quot;</code>找到12个非字母数字字符<code>&quot;123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.&quot;</code>
testString: 'assert("123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.".match(nonAlphabetRegex).length == 12, "Your regex should find 12 non-alphanumeric characters in <code>"123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ."</code>");'
testString: assert("123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.".match(nonAlphabetRegex).length == 12);
```

View File

@ -18,11 +18,11 @@ localeTitle: 匹配字母的字母
```yml
tests:
- text: 你的正则表达式<code>alphabetRegex</code>应该匹配35项。
testString: 'assert(result.length == 35, "Your regex <code>alphabetRegex</code> should match 35 items.");'
testString: assert(result.length == 35);
- text: 你的正则表达式<code>alphabetRegex</code>应该使用全局标志。
testString: 'assert(alphabetRegex.flags.match(/g/).length == 1, "Your regex <code>alphabetRegex</code> should use the global flag.");'
testString: assert(alphabetRegex.flags.match(/g/).length == 1);
- text: 你的正则表达式<code>alphabetRegex</code>应该使用不区分大小写的标志。
testString: 'assert(alphabetRegex.flags.match(/i/).length == 1, "Your regex <code>alphabetRegex</code> should use the case insensitive flag.");'
testString: assert(alphabetRegex.flags.match(/i/).length == 1);
```

View File

@ -18,11 +18,11 @@ localeTitle: 匹配文字字符串
```yml
tests:
- text: 你的正则表达式<code>waldoRegex</code>应该找到<code>&quot;Waldo&quot;</code>
testString: 'assert(waldoRegex.test(waldoIsHiding), "Your regex <code>waldoRegex</code> should find <code>"Waldo"</code>");'
testString: assert(waldoRegex.test(waldoIsHiding));
- text: 你的正则表达式<code>waldoRegex</code>不应该搜索任何其他内容。
testString: 'assert(!waldoRegex.test("Somewhere is hiding in this text."), "Your regex <code>waldoRegex</code> should not search for anything else.");'
testString: assert(!waldoRegex.test('Somewhere is hiding in this text.'));
- text: 您应该与正则表达式执行文字字符串匹配。
testString: 'assert(!/\/.*\/i/.test(code), "You should perform a literal string match with your regex.");'
testString: assert(!/\/.*\/i/.test(code));
```

View File

@ -18,15 +18,15 @@ localeTitle: 匹配非空白字符
```yml
tests:
- text: 你的正则表达式应该使用全局标志。
testString: 'assert(countNonWhiteSpace.global, "Your regex should use the global flag.");'
testString: assert(countNonWhiteSpace.global);
- text: 你的正则表达式应该使用速记字符
testString: 'assert(/\\S/.test(countNonWhiteSpace.source), "Your regex should use the shorthand character <code>\S/code> to match all non-whitespace characters.");'
testString: assert(/\\S/.test(countNonWhiteSpace.source));
- text: 你的正则表达式应该在<code>&quot;Men are from Mars and women are from Venus.&quot;</code>找到35个非空格<code>&quot;Men are from Mars and women are from Venus.&quot;</code>
testString: 'assert("Men are from Mars and women are from Venus.".match(countNonWhiteSpace).length == 35, "Your regex should find 35 non-spaces in <code>"Men are from Mars and women are from Venus."</code>");'
testString: assert("Men are from Mars and women are from Venus.".match(countNonWhiteSpace).length == 35);
- text: '你的正则表达式应该在<code>&quot;Space: the final frontier.&quot;</code>找到23个非空格<code>&quot;Space: the final frontier.&quot;</code>'
testString: 'assert("Space: the final frontier.".match(countNonWhiteSpace).length == 23, "Your regex should find 23 non-spaces in <code>"Space: the final frontier."</code>");'
testString: 'assert("Space: the final frontier.".match(countNonWhiteSpace).length == 23);'
- text: 你的正则表达式应该在<code>&quot;MindYourPersonalSpace&quot;</code>找到21个非空格
testString: 'assert("MindYourPersonalSpace".match(countNonWhiteSpace).length == 21, "Your regex should find 21 non-spaces in <code>"MindYourPersonalSpace"</code>");'
testString: assert("MindYourPersonalSpace".match(countNonWhiteSpace).length == 21);
```

View File

@ -18,11 +18,11 @@ localeTitle: 匹配数字和字母的字母
```yml
tests:
- text: 你的正则表达式<code>myRegex</code>应该匹配17项。
testString: 'assert(result.length == 17, "Your regex <code>myRegex</code> should match 17 items.");'
testString: assert(result.length == 17);
- text: 你的正则表达式<code>myRegex</code>应该使用全局标志。
testString: 'assert(myRegex.flags.match(/g/).length == 1, "Your regex <code>myRegex</code> should use the global flag.");'
testString: assert(myRegex.flags.match(/g/).length == 1);
- text: 你的正则表达式<code>myRegex</code>应该使用不区分大小写的标志。
testString: 'assert(myRegex.flags.match(/i/).length == 1, "Your regex <code>myRegex</code> should use the case insensitive flag.");'
testString: assert(myRegex.flags.match(/i/).length == 1);
```

View File

@ -18,15 +18,15 @@ localeTitle: 将单个角色与多种可能性相匹配
```yml
tests:
- text: 你应该找到所有25个元音。
testString: 'assert(result.length == 25, "You should find all 25 vowels.");'
testString: assert(result.length == 25);
- text: 你的正则表达式<code>vowelRegex</code>应该使用一个字符类。
testString: 'assert(/\[.*\]/.test(vowelRegex.source), "Your regex <code>vowelRegex</code> should use a character class.");'
testString: assert(/\[.*\]/.test(vowelRegex.source));
- text: 你的正则表达式<code>vowelRegex</code>应该使用全局标志。
testString: 'assert(vowelRegex.flags.match(/g/).length == 1, "Your regex <code>vowelRegex</code> should use the global flag.");'
testString: assert(vowelRegex.flags.match(/g/).length == 1);
- text: 你的正则表达式<code>vowelRegex</code>应该使用不区分大小写的标志。
testString: 'assert(vowelRegex.flags.match(/i/).length == 1, "Your regex <code>vowelRegex</code> should use the case insensitive flag.");'
testString: assert(vowelRegex.flags.match(/i/).length == 1);
- text: 你的正则表达式不应该与任何辅音匹配。
testString: 'assert(!/[b-df-hj-np-tv-z]/gi.test(result.join()), "Your regex should not match any consonants.");'
testString: assert(!/[b-df-hj-np-tv-z]/gi.test(result.join()));
```

View File

@ -18,11 +18,11 @@ localeTitle: 匹配未指定的单个字符
```yml
tests:
- text: 你的正则表达式<code>myRegex</code>应匹配9项。
testString: 'assert(result.length == 9, "Your regex <code>myRegex</code> should match 9 items.");'
testString: assert(result.length == 9);
- text: 你的正则表达式<code>myRegex</code>应该使用全局标志。
testString: 'assert(myRegex.flags.match(/g/).length == 1, "Your regex <code>myRegex</code> should use the global flag.");'
testString: assert(myRegex.flags.match(/g/).length == 1);
- text: 你的正则表达式<code>myRegex</code>应该使用不区分大小写的标志。
testString: 'assert(myRegex.flags.match(/i/).length == 1, "Your regex <code>myRegex</code> should use the case insensitive flag.");'
testString: assert(myRegex.flags.match(/i/).length == 1);
```

View File

@ -18,15 +18,15 @@ localeTitle: 匹配空白
```yml
tests:
- text: 你的正则表达式应该使用全局标志。
testString: 'assert(countWhiteSpace.global, "Your regex should use the global flag.");'
testString: assert(countWhiteSpace.global);
- text: 你的正则表达式应该使用速记字符
testString: 'assert(/\\s/.test(countWhiteSpace.source), "Your regex should use the shorthand character <code>\s</code> to match all whitespace characters.");'
testString: assert(/\\s/.test(countWhiteSpace.source));
- text: 你的正则表达式应该在<code>&quot;Men are from Mars and women are from Venus.&quot;</code>找到八个空格<code>&quot;Men are from Mars and women are from Venus.&quot;</code>
testString: 'assert("Men are from Mars and women are from Venus.".match(countWhiteSpace).length == 8, "Your regex should find eight spaces in <code>"Men are from Mars and women are from Venus."</code>");'
testString: assert("Men are from Mars and women are from Venus.".match(countWhiteSpace).length == 8);
- text: '你的正则表达式应该在<code>&quot;Space: the final frontier.&quot;</code>找到三个空格<code>&quot;Space: the final frontier.&quot;</code>'
testString: 'assert("Space: the final frontier.".match(countWhiteSpace).length == 3, "Your regex should find three spaces in <code>"Space: the final frontier."</code>");'
- text: ''
testString: 'assert("MindYourPersonalSpace".match(countWhiteSpace) == null, "Your regex should find no spaces in <code>"MindYourPersonalSpace"</code>");'
testString: 'assert("Space: the final frontier.".match(countWhiteSpace).length == 3);'
- text: 您的正则表达式应该在<code>"MindYourPersonalSpace"</code>中找不到空格
testString: assert("MindYourPersonalSpace".match(countWhiteSpace) == null);
```

View File

@ -18,21 +18,21 @@ localeTitle: 积极和消极的前瞻
```yml
tests:
- text: 你的正则表达式应该使用两个积极的<code>lookaheads</code> 。
testString: 'assert(pwRegex.source.match(/\(\?=.*?\)\(\?=.*?\)/) !== null, "Your regex should use two positive <code>lookaheads</code>.");'
testString: assert(pwRegex.source.match(/\(\?=.*?\)\(\?=.*?\)/) !== null);
- text: 你的正则表达式不应该匹配<code>&quot;astronaut&quot;</code>
testString: 'assert(!pwRegex.test("astronaut"), "Your regex should not match <code>"astronaut"</code>");'
testString: assert(!pwRegex.test("astronaut"));
- text: 你的正则表达式不应该与<code>&quot;airplanes&quot;</code>匹配
testString: 'assert(!pwRegex.test("airplanes"), "Your regex should not match <code>"airplanes"</code>");'
testString: assert(!pwRegex.test("airplanes"));
- text: 你的正则表达式不应该匹配<code>&quot;banan1&quot;</code>
testString: 'assert(!pwRegex.test("banan1"), "Your regex should not match <code>"banan1"</code>");'
testString: assert(!pwRegex.test("banan1"));
- text: 你的正则表达式应该匹配<code>&quot;bana12&quot;</code>
testString: 'assert(pwRegex.test("bana12"), "Your regex should match <code>"bana12"</code>");'
testString: assert(pwRegex.test("bana12"));
- text: 你的正则表达式应该匹配<code>&quot;abc123&quot;</code>
testString: 'assert(pwRegex.test("abc123"), "Your regex should match <code>"abc123"</code>");'
testString: assert(pwRegex.test("abc123"));
- text: 你的正则表达式不应该匹配<code>&quot;123&quot;</code>
testString: 'assert(!pwRegex.test("123"), "Your regex should not match <code>"123"</code>");'
testString: assert(!pwRegex.test("123"));
- text: 你的正则表达式不应该匹配<code>&quot;1234&quot;</code>
testString: 'assert(!pwRegex.test("1234"), "Your regex should not match <code>"1234"</code>");'
testString: assert(!pwRegex.test("1234"));
```

View File

@ -18,11 +18,11 @@ localeTitle: 从开始和结束中删除空格
```yml
tests:
- text: '<code>result</code>应该等于<code>&quot;Hello, World!&quot;</code>'
testString: 'assert(result == "Hello, World!", "<code>result</code> should equal to <code>"Hello, World!"</code>");'
testString: assert(result == "Hello, World!");
- text: 您不应该使用<code>.trim()</code>方法。
testString: 'assert(!code.match(/\.trim\(.*?\)/), "You should not use the <code>.trim()</code> method.");'
testString: assert(!code.match(/\.trim\([\s\S]*?\)/));
- text: <code>result</code>变量不应设置为等于字符串。
testString: 'assert(!code.match(/result\s*=\s*".*?"/), "The <code>result</code> variable should not be set equal to a string.");'
testString: assert(!code.match(/result\s*=\s*".*?"/));
```

View File

@ -18,25 +18,25 @@ localeTitle: 使用捕获组重用模式
```yml
tests:
- text: 你的正则表达式应该使用数字的速记字符类。
testString: 'assert(reRegex.source.match(/\\d/), "Your regex should use the shorthand character class for digits.");'
testString: assert(reRegex.source.match(/\\d/));
- text: 您的正则表达式应该重复使用捕获组两次。
testString: 'assert(reRegex.source.match(/\\\d/g).length === 2, "Your regex should reuse the capture group twice.");'
testString: assert(reRegex.source.match(/\\1|\\2/g).length >= 2);
- text: 你的正则表达式应该有两个空格来分隔这三个数字。
testString: 'assert(reRegex.source.match(/\\s/g).length === 2, "Your regex should have two spaces separating the three numbers.");'
testString: assert(reRegex.source.match(/ |\\s/g).length === 2 || reRegex.source.match(/\(\\s\)(?=.*\\(1|2))/g));
- text: 你的正则表达式应该匹配<code>&quot;42 42 42&quot;</code> 。
testString: 'assert(reRegex.test("42 42 42"), "Your regex should match <code>"42 42 42"</code>.");'
testString: assert(reRegex.test("42 42 42"));
- text: 你的正则表达式应该匹配<code>&quot;100 100 100&quot;</code> 。
testString: 'assert(reRegex.test("100 100 100"), "Your regex should match <code>"100 100 100"</code>.");'
testString: assert(reRegex.test("100 100 100"));
- text: 你的正则表达式不应该匹配<code>&quot;42 42 42 42&quot;</code> 。
testString: 'assert.equal(("42 42 42 42").match(reRegex.source), null, "Your regex should not match <code>"42 42 42 42"</code>.");'
testString: assert.equal(("42 42 42 42").match(reRegex.source), null);
- text: 你的正则表达式不应该匹配<code>&quot;42 42&quot;</code> 。
testString: 'assert.equal(("42 42").match(reRegex.source), null, "Your regex should not match <code>"42 42"</code>.");'
testString: assert.equal(("42 42").match(reRegex.source), null);
- text: 你的正则表达式不应该匹配<code>&quot;101 102 103&quot;</code> 。
testString: 'assert(!reRegex.test("101 102 103"), "Your regex should not match <code>"101 102 103"</code>.");'
testString: assert(!reRegex.test("101 102 103"));
- text: 你的正则表达式不应该匹配<code>&quot;1 2 3&quot;</code> 。
testString: 'assert(!reRegex.test("1 2 3"), "Your regex should not match <code>"1 2 3"</code>.");'
testString: assert(!reRegex.test("1 2 3"));
- text: 你的正则表达式应匹配<code>&quot;10 10 10&quot;</code> 。
testString: 'assert(reRegex.test("10 10 10"), "Your regex should match <code>"10 10 10"</code>.");'
testString: assert(reRegex.test("10 10 10"));
```

View File

@ -18,17 +18,17 @@ localeTitle: 指定完全匹配数
```yml
tests:
- text: 你的正则表达式应该使用大括号。
testString: 'assert(timRegex.source.match(/{.*?}/).length > 0, "Your regex should use curly brackets.");'
testString: assert(timRegex.source.match(/{.*?}/).length > 0);
- text: 你的正则表达式不应该与<code>&quot;Timber&quot;</code>匹配
testString: 'assert(!timRegex.test("Timber"), "Your regex should not match <code>"Timber"</code>");'
testString: assert(!timRegex.test("Timber"));
- text: 你的正则表达式不应该匹配<code>&quot;Timmber&quot;</code>
testString: 'assert(!timRegex.test("Timmber"), "Your regex should not match <code>"Timmber"</code>");'
testString: assert(!timRegex.test("Timmber"));
- text: 你的正则表达式不应该匹配<code>&quot;Timmmber&quot;</code>
testString: 'assert(!timRegex.test("Timmmber"), "Your regex should not match <code>"Timmmber"</code>");'
testString: assert(!timRegex.test("Timmmber"));
- text: 你的正则表达式应该匹配<code>&quot;Timmmmber&quot;</code>
testString: 'assert(timRegex.test("Timmmmber"), "Your regex should match <code>"Timmmmber"</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"), "Your regex should not match <code>"Timber"</code> with 30 <code>m</code>\"s in it.");'
testString: assert(!timRegex.test("Ti" + "m".repeat(30) + "ber"));
```

View File

@ -18,19 +18,19 @@ localeTitle: 仅指定较低的匹配数
```yml
tests:
- text: 你的正则表达式应该使用大括号。
testString: 'assert(haRegex.source.match(/{.*?}/).length > 0, "Your regex should use curly brackets.");'
testString: assert(haRegex.source.match(/{.*?}/).length > 0);
- text: 你的正则表达式不应该与<code>&quot;Hazzah&quot;</code>匹配
testString: 'assert(!haRegex.test("Hazzah"), "Your regex should not match <code>"Hazzah"</code>");'
testString: assert(!haRegex.test("Hazzah"));
- text: 你的正则表达式不应该与<code>&quot;Hazzzah&quot;</code>匹配
testString: 'assert(!haRegex.test("Hazzzah"), "Your regex should not match <code>"Hazzzah"</code>");'
testString: assert(!haRegex.test("Hazzzah"));
- text: 你的正则表达应该匹配<code>&quot;Hazzzzah&quot;</code>
testString: 'assert(haRegex.test("Hazzzzah"), "Your regex should match <code>"Hazzzzah"</code>");'
testString: assert("Hazzzzah".match(haRegex)[0].length === 8);
- text: 你的正则表达应该匹配<code>&quot;Hazzzzzah&quot;</code>
testString: 'assert(haRegex.test("Hazzzzzah"), "Your regex should match <code>"Hazzzzzah"</code>");'
testString: assert("Hazzzzzah".match(haRegex)[0].length === 9);
- text: 你的正则表达应该匹配<code>&quot;Hazzzzzzah&quot;</code>
testString: 'assert(haRegex.test("Hazzzzzzah"), "Your regex should match <code>"Hazzzzzzah"</code>");'
testString: assert("Hazzzzzzah".match(haRegex)[0].length === 10);
- text: 你的正则表达式应该匹配<code>&quot;Hazzah&quot;</code>和30个<code>z</code> 。
testString: 'assert(haRegex.test("Ha" + "z".repeat(30) + "ah"), "Your regex should match <code>"Hazzah"</code> with 30 <code>z</code>\"s in it.");'
testString: assert("Hazzzzzzzzzzzzzzzzzzzzzzzzzzzzzzah".match(haRegex)[0].length === 34);
```

View File

@ -18,19 +18,19 @@ localeTitle: 指定上下匹配数
```yml
tests:
- text: 你的正则表达式应该使用大括号。
testString: 'assert(ohRegex.source.match(/{.*?}/).length > 0, "Your regex should use curly brackets.");'
testString: assert(ohRegex.source.match(/{.*?}/).length > 0);
- text: 你的正则表达式不应该匹配<code>&quot;Ohh no&quot;</code>
testString: 'assert(!ohRegex.test("Ohh no"), "Your regex should not match <code>"Ohh no"</code>");'
testString: assert(!ohRegex.test("Ohh no"));
- text: 你的正则表达式应该匹配<code>&quot;Ohhh no&quot;</code>
testString: 'assert(ohRegex.test("Ohhh no"), "Your regex should match <code>"Ohhh no"</code>");'
testString: assert("Ohhh no".match(ohRegex)[0].length === 7);
- text: 你的正则表达式应该匹配<code>&quot;Ohhhh no&quot;</code>
testString: 'assert(ohRegex.test("Ohhhh no"), "Your regex should match <code>"Ohhhh no"</code>");'
testString: assert("Ohhhh no".match(ohRegex)[0].length === 8);
- text: 你的正则表达式应该匹配<code>&quot;Ohhhhh no&quot;</code>
testString: 'assert(ohRegex.test("Ohhhhh no"), "Your regex should match <code>"Ohhhhh no"</code>");'
testString: assert("Ohhhhh no".match(ohRegex)[0].length === 9);
- text: 你的正则表达式应该匹配<code>&quot;Ohhhhhh no&quot;</code>
testString: 'assert(ohRegex.test("Ohhhhhh no"), "Your regex should match <code>"Ohhhhhh no"</code>");'
testString: assert("Ohhhhhh no".match(ohRegex)[0].length === 10);
- text: 你的正则表达式不应该匹配<code>&quot;Ohhhhhhh no&quot;</code>
testString: 'assert(!ohRegex.test("Ohhhhhhh no"), "Your regex should not match <code>"Ohhhhhhh no"</code>");'
testString: assert(!ohRegex.test("Ohhhhhhh no"));
```

View File

@ -18,11 +18,11 @@ localeTitle: 使用捕获组进行搜索和替换
```yml
tests:
- text: 您应该使用<code>.replace()</code>来搜索和替换。
testString: 'assert(code.match(/\.replace\(.*\)/), "You should use <code>.replace()</code> to search and replace.");'
testString: assert(code.match(/\.replace\(.*\)/));
- text: 你的正则表达式应该改变<code>&quot;This sandwich is good.&quot;</code> <code>&quot;This sandwich is okey-dokey.&quot;</code>
testString: 'assert(result == "This sandwich is okey-dokey." && replaceText === "okey-dokey", "Your regex should change <code>"This sandwich is good."</code> to <code>"This sandwich is okey-dokey."</code>");'
testString: assert(result == "This sandwich is okey-dokey." && replaceText === "okey-dokey");
- text: 你不应该改变最后一行。
testString: 'assert(code.match(/result\s*=\s*huhText\.replace\(.*?\)/), "You should not change the last line.");'
testString: assert(code.match(/result\s*=\s*huhText\.replace\(.*?\)/));
```

View File

@ -18,9 +18,9 @@ localeTitle: 使用测试方法
```yml
tests:
- text: 你应该使用<code>.test()</code>来测试正则表达式。
testString: 'assert(code.match(/myRegex.test\(\s*myString\s*\)/), "You should use <code>.test()</code> to test the regex.");'
testString: assert(code.match(/myRegex.test\(\s*myString\s*\)/));
- text: 您的结果应该返回<code>true</code> 。
testString: 'assert(result === true, "Your result should return <code>true</code>.");'
testString: assert(result === true);
```