diff --git a/curriculum/challenges/chinese-traditional/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md b/curriculum/challenges/chinese-traditional/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md index d9f6fe7aa6..1bd4343948 100644 --- a/curriculum/challenges/chinese-traditional/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md +++ b/curriculum/challenges/chinese-traditional/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md @@ -14,7 +14,7 @@ dashedName: build-a-product-landing-page 你可以使用 HTML、JavaScript 以及 CSS 來完成項目。 由於目前你只學到了 CSS 課程,所以我們建議你只使用 CSS 來完成這個項目,同時鞏固一下你之前所學的內容。 你也可以使用 Bootstrap 或者 SASS。 我們不推薦你在這個項目中使用其他技術(比如 jQuery、React、Angular 或 Vue)。 在後續的其他項目中,你將有機會使用像是 React 等其他技術棧。 我們會接受並嘗試修復你在使用推薦技術棧創建項目時報告的問題。 祝你編碼愉快! -**需求 1:** 產品登陸頁應存在 `id="header"` 的 `header` 元素。 +**需求 1:** 產品登錄頁應存在 `id="header"` 的 `header` 元素。 **需求 2:** 在 `header` 元素內應存在 `id="header-img"` 的圖像, 這裏通常用來放置公司的 logo。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.md index 379c49aeba..b6aafb253a 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.md @@ -69,12 +69,14 @@ assert( 你的正則表達式在`""`中不應該匹配到任何罪犯 ```js +reCriminals.lastIndex = 0; assert(!reCriminals.test('')); ``` 你的正則表達式在`P1P2P3`中不應該匹配到任何罪犯 ```js +reCriminals.lastIndex = 0; assert(!reCriminals.test('P1P2P3')); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.md index ec4a85432d..70f73627fe 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.md @@ -23,60 +23,70 @@ dashedName: ignore-case-while-matching 你的正則表達式應該匹配 `freeCodeCamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('freeCodeCamp')); ``` 你的正則表達式應該匹配 `FreeCodeCamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FreeCodeCamp')); ``` 你的正則表達式應該匹配 `FreecodeCamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FreecodeCamp')); ``` 你的正則表達式應該匹配 `FreeCodecamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FreeCodecamp')); ``` 你的正則表達式不應該匹配 `Free Code Camp` ```js +fccRegex.lastIndex = 0; assert(!fccRegex.test('Free Code Camp')); ``` 您的正則表達式應該匹配字符串 `FreeCOdeCamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FreeCOdeCamp')); ``` 你的正則表達式不應該匹配 `FCC` ```js +fccRegex.lastIndex = 0; assert(!fccRegex.test('FCC')); ``` 你的正則表達式應該匹配字符串 `FrEeCoDeCamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FrEeCoDeCamp')); ``` 你的正則表達式應該匹配字符串 `FrEeCodECamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FrEeCodECamp')); ``` 你的正則表達式應該匹配字符串 `FReeCodeCAmp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FReeCodeCAmp')); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.md index f1ecce39fa..38236abab3 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.md @@ -25,42 +25,49 @@ dashedName: match-a-literal-string-with-different-possibilities 對於字符串 `John has a pet dog.`,你的正則表達式`petRegex` 應該返回 `true` ```js +petRegex.lastIndex = 0; assert(petRegex.test('John has a pet dog.')); ``` 對於字符串 `Emma has a pet rock.`,你的正則表達式 `petRegex` 的應該返回 `false` ```js +petRegex.lastIndex = 0; assert(!petRegex.test('Emma has a pet rock.')); ``` 對於字符串 `Emma has a pet bird.`,你的正則表達式 `petRegex` 應該返回 `true` ```js +petRegex.lastIndex = 0; assert(petRegex.test('Emma has a pet bird.')); ``` 對於字符串 `Liz has a pet cat.`,你的正則表達式 `petRegex` 應該返回 `true` ```js +petRegex.lastIndex = 0; assert(petRegex.test('Liz has a pet cat.')); ``` 對於字符串 `Kara has a pet dolphin.`,你的正則表達式 `petRegex` 應該返回 `false` ```js +petRegex.lastIndex = 0; assert(!petRegex.test('Kara has a pet dolphin.')); ``` 對於字符串 `Alice has a pet fish.`,你的正則表達式 `petRegex` 應該返回 `true`。 ```js +petRegex.lastIndex = 0; assert(petRegex.test('Alice has a pet fish.')); ``` 對於字符串 `Jimmy has a pet computer.`,你的正則表達式 `petRegex` 應該返回 `false`。 ```js +petRegex.lastIndex = 0; assert(!petRegex.test('Jimmy has a pet computer.')); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.md index 47f5c00866..0f3b9a6762 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.md @@ -43,12 +43,14 @@ assert(calRegex.flags == ''); 你的正則表達式應該匹配字符串 `Cal` 的開始位置。 ```js +calRegex.lastIndex = 0; assert(calRegex.test('Cal and Ricky both like racing.')); ``` 你的正則表達式不應該匹配中間包含 `Cal` 的字符串。 ```js +calRegex.lastIndex = 0; assert(!calRegex.test('Ricky and Cal both like racing.')); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.md index 825f6b3ac7..f522191465 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.md @@ -43,6 +43,7 @@ assert(lastRegex.flags == ''); 你應該在字符串 `The last car on a train is the caboose` 的末尾匹配 `caboose`。 ```js +lastRegex.lastIndex = 0; assert(lastRegex.test('The last car on a train is the caboose')); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md index dea404d5f1..2441dd76ac 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md @@ -38,12 +38,14 @@ wrongRegex.test(testStr); 你的正則表達式 `waldoRegex` 應該匹配到 `Waldo`。 ```js +waldoRegex.lastIndex = 0; assert(waldoRegex.test(waldoIsHiding)); ``` 你的正則表達式 `waldoRegex` 不應該搜尋其他的任何內容。 ```js +waldoRegex.lastIndex = 0; assert(!waldoRegex.test('Somewhere is hiding in this text.')); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.md index 8e307ccd4f..cee81e78e0 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.md @@ -52,48 +52,56 @@ assert(pwRegex.source.match(/\(\?=.*?\)\(\?=.*?\)/) !== null); 您的正則表達式不應匹配字符串 `astronaut` ```js +pwRegex.lastIndex = 0; assert(!pwRegex.test('astronaut')); ``` 你的正則表達式不應匹配字符串 `banan1` ```js +pwRegex.lastIndex = 0; assert(!pwRegex.test('banan1')); ``` 你的正則表達式應該匹配字符串 `bana12` ```js +pwRegex.lastIndex = 0; assert(pwRegex.test('bana12')); ``` 你的正則表達式應該匹配字符串 `abc123` ```js +pwRegex.lastIndex = 0; assert(pwRegex.test('abc123')); ``` 你的正則表達式不應匹配字符串 `12345` ```js +pwRegex.lastIndex = 0; assert(!pwRegex.test('12345')); ``` 你的正則表達式應該匹配字符串 `8pass99` ```js +pwRegex.lastIndex = 0; assert(pwRegex.test('8pass99')); ``` 你的正表達式不應匹配字符串 `1a2bcde` ```js +pwRegex.lastIndex = 0; assert(!pwRegex.test('1a2bcde')); ``` 你的正則表達式應該匹配字符串 `astr1on11aut` ```js +pwRegex.lastIndex = 0; assert(pwRegex.test('astr1on11aut')); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/restrict-possible-usernames.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/restrict-possible-usernames.md index 282e9dc959..9ffc94d690 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/restrict-possible-usernames.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/restrict-possible-usernames.md @@ -29,78 +29,91 @@ dashedName: restrict-possible-usernames 你的正則表達式應該匹配字符串 `JACK` ```js +userCheck.lastIndex = 0; assert(userCheck.test('JACK')); ``` 你的正則表達式不應匹配字符串 `J` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('J')); ``` 你的正則表達式應該匹配字符串 `Jo` ```js +userCheck.lastIndex = 0; assert(userCheck.test('Jo')); ``` 你的正則表達式應該匹配字符串 `Oceans11` ```js +userCheck.lastIndex = 0; assert(userCheck.test('Oceans11')); ``` 你的正則表達式應該匹配字符串 `RegexGuru` ```js +userCheck.lastIndex = 0; assert(userCheck.test('RegexGuru')); ``` 你的正則表達式不應匹配字符串 `007` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('007')); ``` 你的正則表達式不應匹配字符串 `9` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('9')); ``` 你的正則表達式不應匹配字符串 `A1` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('A1')); ``` 你的正則表達式不應匹配字符串 `BadUs3rnam3` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('BadUs3rnam3')); ``` 你的正則表達式應該匹配字符串 `Z97` ```js +userCheck.lastIndex = 0; assert(userCheck.test('Z97')); ``` 你的正則表達式不應匹配字符串 `c57bT3` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('c57bT3')); ``` 你的正則表達式應該匹配字符串 `AB1` ```js +userCheck.lastIndex = 0; assert(userCheck.test('AB1')); ``` 你的正則表達式不應匹配字符串 `J%4` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('J%4')) ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.md index a8cf713815..04f2611d67 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.md @@ -52,12 +52,14 @@ assert(reRegex.source.match(/\\1|\\2/g).length >= 2); 你的正則表達式應該匹配字符串 `42 42 42`。 ```js +reRegex.lastIndex = 0; assert(reRegex.test('42 42 42')); ``` 你的正則表達式應該匹配字符串 `100 100 100`。 ```js +reRegex.lastIndex = 0; assert(reRegex.test('100 100 100')); ``` @@ -76,18 +78,21 @@ assert.equal('42 42'.match(reRegex.source), null); 你的正則表達式不應該匹配字符串 `101 102 103`。 ```js +reRegex.lastIndex = 0; assert(!reRegex.test('101 102 103')); ``` 你的正則表達式不應匹配字符串 `1 2 3`。 ```js +reRegex.lastIndex = 0; assert(!reRegex.test('1 2 3')); ``` 你的正則表達式不應匹配字符串 `10 10 10`。 ```js +reRegex.lastIndex = 0; assert(reRegex.test('10 10 10')); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/specify-only-the-lower-number-of-matches.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/specify-only-the-lower-number-of-matches.md index ba6da44f89..af41ae0f22 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/specify-only-the-lower-number-of-matches.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/specify-only-the-lower-number-of-matches.md @@ -41,12 +41,14 @@ assert(haRegex.source.match(/{.*?}/).length > 0); 你的正則表達式不應匹配字符串 `Hazzah` ```js +haRegex.lastIndex = 0; assert(!haRegex.test('Hazzah')); ``` 你的正則表達式不應匹配字符串 `Hazzzah` ```js +haRegex.lastIndex = 0; assert(!haRegex.test('Hazzzah')); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches.md index 45332abd5a..84abe7da12 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches.md @@ -39,6 +39,7 @@ assert(ohRegex.source.match(/{.*?}/).length > 0); 你的正則表達式不應匹配字符串 `Ohh no` ```js +ohRegex.lastIndex = 0; assert(!ohRegex.test('Ohh no')); ``` @@ -69,6 +70,7 @@ assert('Ohhhhhh no'.match(ohRegex)[0].length === 10); 你的正則表達式應該匹配字符串 `Ohhhhhhh no` ```js +ohRegex.lastIndex = 0; assert(!ohRegex.test('Ohhhhhhh no')); ``` diff --git a/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md b/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md index 8da6213aa9..4fa469685f 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md @@ -14,7 +14,7 @@ dashedName: build-a-product-landing-page 你可以使用 HTML、JavaScript 以及 CSS 来完成项目。 由于目前你只学到了 CSS 课程,所以我们建议你只使用 CSS 来完成这个项目,同时巩固一下你之前所学的内容。 你也可以使用 Bootstrap 或者 SASS。 我们不推荐你在这个项目中使用其他技术(比如 jQuery、React、Angular 或 Vue)。 在后续的其他项目中,你将有机会使用像是 React 等其他技术栈。 我们会接受并尝试修复你在使用推荐技术栈创建项目时报告的问题。 祝你编码愉快! -**需求 1:** 产品登陆页应存在 `id="header"` 的 `header` 元素。 +**需求 1:** 产品登录页应存在 `id="header"` 的 `header` 元素。 **需求 2:** 在 `header` 元素内应存在 `id="header-img"` 的图像, 这里通常用来放置公司的 logo。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.md index 9be3c35015..0c9fe3cc92 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.md @@ -69,12 +69,14 @@ assert( 你的正则表达式在`""`中不应该匹配到任何罪犯 ```js +reCriminals.lastIndex = 0; assert(!reCriminals.test('')); ``` 你的正则表达式在`P1P2P3`中不应该匹配到任何罪犯 ```js +reCriminals.lastIndex = 0; assert(!reCriminals.test('P1P2P3')); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.md index 1ec17884aa..2f5ebb8697 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.md @@ -23,60 +23,70 @@ dashedName: ignore-case-while-matching 你的正则表达式应该匹配 `freeCodeCamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('freeCodeCamp')); ``` 你的正则表达式应该匹配 `FreeCodeCamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FreeCodeCamp')); ``` 你的正则表达式应该匹配 `FreecodeCamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FreecodeCamp')); ``` 你的正则表达式应该匹配 `FreeCodecamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FreeCodecamp')); ``` 你的正则表达式不应该匹配 `Free Code Camp` ```js +fccRegex.lastIndex = 0; assert(!fccRegex.test('Free Code Camp')); ``` 您的正则表达式应该匹配字符串 `FreeCOdeCamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FreeCOdeCamp')); ``` 你的正则表达式不应该匹配 `FCC` ```js +fccRegex.lastIndex = 0; assert(!fccRegex.test('FCC')); ``` 你的正则表达式应该匹配字符串 `FrEeCoDeCamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FrEeCoDeCamp')); ``` 你的正则表达式应该匹配字符串 `FrEeCodECamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FrEeCodECamp')); ``` 你的正则表达式应该匹配字符串 `FReeCodeCAmp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FReeCodeCAmp')); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.md index b253f60c18..50798fdff5 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.md @@ -25,42 +25,49 @@ dashedName: match-a-literal-string-with-different-possibilities 对于字符串 `John has a pet dog.`,你的正则表达式`petRegex` 应该返回 `true` ```js +petRegex.lastIndex = 0; assert(petRegex.test('John has a pet dog.')); ``` 对于字符串 `Emma has a pet rock.`,你的正则表达式 `petRegex` 的应该返回 `false` ```js +petRegex.lastIndex = 0; assert(!petRegex.test('Emma has a pet rock.')); ``` 对于字符串 `Emma has a pet bird.`,你的正则表达式 `petRegex` 应该返回 `true` ```js +petRegex.lastIndex = 0; assert(petRegex.test('Emma has a pet bird.')); ``` 对于字符串 `Liz has a pet cat.`,你的正则表达式 `petRegex` 应该返回 `true` ```js +petRegex.lastIndex = 0; assert(petRegex.test('Liz has a pet cat.')); ``` 对于字符串 `Kara has a pet dolphin.`,你的正则表达式 `petRegex` 应该返回 `false` ```js +petRegex.lastIndex = 0; assert(!petRegex.test('Kara has a pet dolphin.')); ``` 对于字符串 `Alice has a pet fish.`,你的正则表达式 `petRegex` 应该返回 `true`。 ```js +petRegex.lastIndex = 0; assert(petRegex.test('Alice has a pet fish.')); ``` 对于字符串 `Jimmy has a pet computer.`,你的正则表达式 `petRegex` 应该返回 `false`。 ```js +petRegex.lastIndex = 0; assert(!petRegex.test('Jimmy has a pet computer.')); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.md index 08127c94e0..a8e55ee006 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.md @@ -43,12 +43,14 @@ assert(calRegex.flags == ''); 你的正则表达式应该匹配字符串 `Cal` 的开始位置。 ```js +calRegex.lastIndex = 0; assert(calRegex.test('Cal and Ricky both like racing.')); ``` 你的正则表达式不应该匹配中间包含 `Cal` 的字符串。 ```js +calRegex.lastIndex = 0; assert(!calRegex.test('Ricky and Cal both like racing.')); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.md index 49f91af819..ae994bc0db 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.md @@ -43,6 +43,7 @@ assert(lastRegex.flags == ''); 你应该在字符串 `The last car on a train is the caboose` 的末尾匹配 `caboose`。 ```js +lastRegex.lastIndex = 0; assert(lastRegex.test('The last car on a train is the caboose')); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md index aac3b2d092..a7334120cd 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md @@ -38,12 +38,14 @@ wrongRegex.test(testStr); 你的正则表达式 `waldoRegex` 应该匹配到 `Waldo`。 ```js +waldoRegex.lastIndex = 0; assert(waldoRegex.test(waldoIsHiding)); ``` 你的正则表达式 `waldoRegex` 不应该搜寻其他的任何内容。 ```js +waldoRegex.lastIndex = 0; assert(!waldoRegex.test('Somewhere is hiding in this text.')); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.md index 9b1053b51f..ccb925d821 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.md @@ -52,48 +52,56 @@ assert(pwRegex.source.match(/\(\?=.*?\)\(\?=.*?\)/) !== null); 您的正则表达式不应匹配字符串 `astronaut` ```js +pwRegex.lastIndex = 0; assert(!pwRegex.test('astronaut')); ``` 你的正则表达式不应匹配字符串 `banan1` ```js +pwRegex.lastIndex = 0; assert(!pwRegex.test('banan1')); ``` 你的正则表达式应该匹配字符串 `bana12` ```js +pwRegex.lastIndex = 0; assert(pwRegex.test('bana12')); ``` 你的正则表达式应该匹配字符串 `abc123` ```js +pwRegex.lastIndex = 0; assert(pwRegex.test('abc123')); ``` 你的正则表达式不应匹配字符串 `12345` ```js +pwRegex.lastIndex = 0; assert(!pwRegex.test('12345')); ``` 你的正则表达式应该匹配字符串 `8pass99` ```js +pwRegex.lastIndex = 0; assert(pwRegex.test('8pass99')); ``` 你的正表达式不应匹配字符串 `1a2bcde` ```js +pwRegex.lastIndex = 0; assert(!pwRegex.test('1a2bcde')); ``` 你的正则表达式应该匹配字符串 `astr1on11aut` ```js +pwRegex.lastIndex = 0; assert(pwRegex.test('astr1on11aut')); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/restrict-possible-usernames.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/restrict-possible-usernames.md index 8ddca8ac3f..8482570cea 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/restrict-possible-usernames.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/restrict-possible-usernames.md @@ -29,78 +29,91 @@ dashedName: restrict-possible-usernames 你的正则表达式应该匹配字符串 `JACK` ```js +userCheck.lastIndex = 0; assert(userCheck.test('JACK')); ``` 你的正则表达式不应匹配字符串 `J` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('J')); ``` 你的正则表达式应该匹配字符串 `Jo` ```js +userCheck.lastIndex = 0; assert(userCheck.test('Jo')); ``` 你的正则表达式应该匹配字符串 `Oceans11` ```js +userCheck.lastIndex = 0; assert(userCheck.test('Oceans11')); ``` 你的正则表达式应该匹配字符串 `RegexGuru` ```js +userCheck.lastIndex = 0; assert(userCheck.test('RegexGuru')); ``` 你的正则表达式不应匹配字符串 `007` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('007')); ``` 你的正则表达式不应匹配字符串 `9` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('9')); ``` 你的正则表达式不应匹配字符串 `A1` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('A1')); ``` 你的正则表达式不应匹配字符串 `BadUs3rnam3` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('BadUs3rnam3')); ``` 你的正则表达式应该匹配字符串 `Z97` ```js +userCheck.lastIndex = 0; assert(userCheck.test('Z97')); ``` 你的正则表达式不应匹配字符串 `c57bT3` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('c57bT3')); ``` 你的正则表达式应该匹配字符串 `AB1` ```js +userCheck.lastIndex = 0; assert(userCheck.test('AB1')); ``` 你的正则表达式不应匹配字符串 `J%4` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('J%4')) ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.md index 396220acc2..40bdd3decf 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.md @@ -52,12 +52,14 @@ assert(reRegex.source.match(/\\1|\\2/g).length >= 2); 你的正则表达式应该匹配字符串 `42 42 42`。 ```js +reRegex.lastIndex = 0; assert(reRegex.test('42 42 42')); ``` 你的正则表达式应该匹配字符串 `100 100 100`。 ```js +reRegex.lastIndex = 0; assert(reRegex.test('100 100 100')); ``` @@ -76,18 +78,21 @@ assert.equal('42 42'.match(reRegex.source), null); 你的正则表达式不应该匹配字符串 `101 102 103`。 ```js +reRegex.lastIndex = 0; assert(!reRegex.test('101 102 103')); ``` 你的正则表达式不应匹配字符串 `1 2 3`。 ```js +reRegex.lastIndex = 0; assert(!reRegex.test('1 2 3')); ``` 你的正则表达式不应匹配字符串 `10 10 10`。 ```js +reRegex.lastIndex = 0; assert(reRegex.test('10 10 10')); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-only-the-lower-number-of-matches.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-only-the-lower-number-of-matches.md index 84d7ac7a27..5c8b0d1adf 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-only-the-lower-number-of-matches.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-only-the-lower-number-of-matches.md @@ -41,12 +41,14 @@ assert(haRegex.source.match(/{.*?}/).length > 0); 你的正则表达式不应匹配字符串 `Hazzah` ```js +haRegex.lastIndex = 0; assert(!haRegex.test('Hazzah')); ``` 你的正则表达式不应匹配字符串 `Hazzzah` ```js +haRegex.lastIndex = 0; assert(!haRegex.test('Hazzzah')); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches.md index 8072f405d7..5c834fda59 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches.md @@ -39,6 +39,7 @@ assert(ohRegex.source.match(/{.*?}/).length > 0); 你的正则表达式不应匹配字符串 `Ohh no` ```js +ohRegex.lastIndex = 0; assert(!ohRegex.test('Ohh no')); ``` @@ -69,6 +70,7 @@ assert('Ohhhhhh no'.match(ohRegex)[0].length === 10); 你的正则表达式应该匹配字符串 `Ohhhhhhh no` ```js +ohRegex.lastIndex = 0; assert(!ohRegex.test('Ohhhhhhh no')); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.md index 077a8c5769..5e5fe9d386 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.md @@ -69,12 +69,14 @@ assert( Tu expresión regular no debe coincidir con ningún criminal en la cadena vacía `""` ```js +reCriminals.lastIndex = 0; assert(!reCriminals.test('')); ``` Tu regex no debe coincidir con ningún criminal en la cadena `P1P2P3` ```js +reCriminals.lastIndex = 0; assert(!reCriminals.test('P1P2P3')); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.md index 0619c5e466..1b4585c71c 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.md @@ -23,60 +23,70 @@ Escribe una expresión regular `fccRegex` para que coincida con `freeCodeCamp` s Tu expresión regular debe coincidir con la cadena `freeCodeCamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('freeCodeCamp')); ``` Tu expresión regular debe coincidir con la cadena `FreeCodeCamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FreeCodeCamp')); ``` Tu expresión regular debe coincidir con la cadena `FreecodeCamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FreecodeCamp')); ``` Tu expresión regular debe coincidir con la cadena `FreeCodecamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FreeCodecamp')); ``` Tu expresión regular no debe coincidir con la cadena `Free Code Camp` ```js +fccRegex.lastIndex = 0; assert(!fccRegex.test('Free Code Camp')); ``` Tu expresión regular debe coincidir con la cadena `FreeCOdeCamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FreeCOdeCamp')); ``` Tu expresión regular no debe coincidir con la cadena `FCC` ```js +fccRegex.lastIndex = 0; assert(!fccRegex.test('FCC')); ``` Tu expresión regular debe coincidir con la cadena `FrEeCoDeCamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FrEeCoDeCamp')); ``` Tu expresión regular debe coincidir con la cadena `FrEeCodECamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FrEeCodECamp')); ``` Tu expresión regular debe coincidir con la cadena `FReeCodeCAmp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FReeCodeCAmp')); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.md index 26c95332a6..f107b34dc4 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.md @@ -25,42 +25,49 @@ Completa la expresión regular `petRegex` para que coincida con las mascotas `do Tu expresión regular `petRegex` debe devolver `true` para la cadena `John has a pet dog.` ```js +petRegex.lastIndex = 0; assert(petRegex.test('John has a pet dog.')); ``` Tu expresión regular `petRegex` debe devolver `false` para la cadena `Emma has a pet rock.` ```js +petRegex.lastIndex = 0; assert(!petRegex.test('Emma has a pet rock.')); ``` Tu expresión regular `petRegex` debe devolver `true` para la cadena `Emma has a pet bird.` ```js +petRegex.lastIndex = 0; assert(petRegex.test('Emma has a pet bird.')); ``` Tu expresión regular `petRegex` debe devolver `true` para la cadena `Liz has a pet cat.` ```js +petRegex.lastIndex = 0; assert(petRegex.test('Liz has a pet cat.')); ``` Tu expresión regular `petRegex` debe devolver `false` para la cadena `Kara has a pet dolphin.` ```js +petRegex.lastIndex = 0; assert(!petRegex.test('Kara has a pet dolphin.')); ``` Tu expresión regular `petRegex` debe devolver `true` para la cadena `Alice has a pet fish.` ```js +petRegex.lastIndex = 0; assert(petRegex.test('Alice has a pet fish.')); ``` Tu expresión regular `petRegex` debe devolver `false` para la cadena `Jimmy has a pet computer.` ```js +petRegex.lastIndex = 0; assert(!petRegex.test('Jimmy has a pet computer.')); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.md index d5ecf38d61..23c6238029 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.md @@ -43,12 +43,14 @@ assert(calRegex.flags == ''); Tu expresión regular debe coincidir con la cadena `Cal` en el inicio de la cadena. ```js +calRegex.lastIndex = 0; assert(calRegex.test('Cal and Ricky both like racing.')); ``` Tu expresión regular debe coincidir con la cadena `Cal` en medio de la cadena. ```js +calRegex.lastIndex = 0; assert(!calRegex.test('Ricky and Cal both like racing.')); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.md index 1a4964183a..cfb86d3e71 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.md @@ -43,6 +43,7 @@ assert(lastRegex.flags == ''); Debes coincidir `caboose` al final de la cadena `The last car on a train is the caboose` ```js +lastRegex.lastIndex = 0; assert(lastRegex.test('The last car on a train is the caboose')); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md index 0985c07a3d..e6424b27f5 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md @@ -38,12 +38,14 @@ Completa la expresión regular `waldoRegex` para encontrar `"Waldo"` en la caden Tu expresión regular `waldoRegex` debe encontrar la cadena `Waldo` ```js +waldoRegex.lastIndex = 0; assert(waldoRegex.test(waldoIsHiding)); ``` Tu expresión regular `waldoRegex` no debe buscar ninguna otra cosa. ```js +waldoRegex.lastIndex = 0; assert(!waldoRegex.test('Somewhere is hiding in this text.')); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.md index 3aaa73c736..32153d9c85 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.md @@ -52,48 +52,56 @@ assert(pwRegex.source.match(/\(\?=.*?\)\(\?=.*?\)/) !== null); Tu expresión regular no debe coincidir con la cadena `astronaut` ```js +pwRegex.lastIndex = 0; assert(!pwRegex.test('astronaut')); ``` Tu expresión regular no debe coincidir con la cadena `banan1` ```js +pwRegex.lastIndex = 0; assert(!pwRegex.test('banan1')); ``` Tu expresión regular debe coincidir con la cadena `bana12` ```js +pwRegex.lastIndex = 0; assert(pwRegex.test('bana12')); ``` Tu expresión regular debe coincidir con la cadena `abc123` ```js +pwRegex.lastIndex = 0; assert(pwRegex.test('abc123')); ``` Tu expresión regular no debe coincidir con la cadena `12345` ```js +pwRegex.lastIndex = 0; assert(!pwRegex.test('12345')); ``` Tu expresión regular debe coincidir con la cadena `8pass99` ```js +pwRegex.lastIndex = 0; assert(pwRegex.test('8pass99')); ``` Tu expresión regular no debe coincidir con la cadena `1a2bcde` ```js +pwRegex.lastIndex = 0; assert(!pwRegex.test('1a2bcde')); ``` Tu expresión regular debe coincidir con la cadena `astr1on11aut` ```js +pwRegex.lastIndex = 0; assert(pwRegex.test('astr1on11aut')); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/restrict-possible-usernames.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/restrict-possible-usernames.md index 791328c1ed..40380510cc 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/restrict-possible-usernames.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/restrict-possible-usernames.md @@ -29,78 +29,91 @@ Cambia la expresión regular `userCheck` para que se ajuste a las restricciones Tu expresión regular debe coincidir con la cadena `JACK` ```js +userCheck.lastIndex = 0; assert(userCheck.test('JACK')); ``` Tu expresión regular no debe coincidir con la cadena `J` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('J')); ``` Tu expresión regular debe coincidir con la cadena `Jo` ```js +userCheck.lastIndex = 0; assert(userCheck.test('Jo')); ``` Tu expresión regular debe coincidir con la cadena `Oceans11` ```js +userCheck.lastIndex = 0; assert(userCheck.test('Oceans11')); ``` Tu expresión regular debe coincidir con la cadena `RegexGuru` ```js +userCheck.lastIndex = 0; assert(userCheck.test('RegexGuru')); ``` Tu expresión regular no debe coincidir con la cadena `007` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('007')); ``` Tu expresión regular no debe coincidir con la cadena `9` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('9')); ``` Tu expresión regular no debe coincidir con la cadena `A1` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('A1')); ``` Tu expresión regular no debe coincidir con la cadena `BadUs3rnam3` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('BadUs3rnam3')); ``` Tu expresión regular debe coincidir con la cadena `Z97` ```js +userCheck.lastIndex = 0; assert(userCheck.test('Z97')); ``` Tu expresión regular no debe coincidir con la cadena `c57bT3` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('c57bT3')); ``` Tu expresión regular debe coincidir con la cadena `AB1` ```js +userCheck.lastIndex = 0; assert(userCheck.test('AB1')); ``` Tu expresión regular no debe coincidir con la cadena `J%4` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('J%4')) ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.md index 9042bc4d1e..18b7bcb1bd 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.md @@ -52,12 +52,14 @@ assert(reRegex.source.match(/\\1|\\2/g).length >= 2); Tu expresión regular debe coincidir con la cadena `42 42 42`. ```js +reRegex.lastIndex = 0; assert(reRegex.test('42 42 42')); ``` Tu expresión regular debe coincidir con la cadena `100 100 100`. ```js +reRegex.lastIndex = 0; assert(reRegex.test('100 100 100')); ``` @@ -76,18 +78,21 @@ assert.equal('42 42'.match(reRegex.source), null); Tu expresión regular no debe coincidir con la cadena `101 102 103`. ```js +reRegex.lastIndex = 0; assert(!reRegex.test('101 102 103')); ``` Tu expresión regular no debe coincidir con la cadena `1 2 3`. ```js +reRegex.lastIndex = 0; assert(!reRegex.test('1 2 3')); ``` Tu expresión regular debe coincidir con la cadena `10 10 10`. ```js +reRegex.lastIndex = 0; assert(reRegex.test('10 10 10')); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/specify-only-the-lower-number-of-matches.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/specify-only-the-lower-number-of-matches.md index 1340241b88..ea299816af 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/specify-only-the-lower-number-of-matches.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/specify-only-the-lower-number-of-matches.md @@ -41,12 +41,14 @@ assert(haRegex.source.match(/{.*?}/).length > 0); La expresión regular no debe coincidir con la cadena `Hazzah` ```js +haRegex.lastIndex = 0; assert(!haRegex.test('Hazzah')); ``` La expresión regular no debe coincidir con la cadena `Hazzzah` ```js +haRegex.lastIndex = 0; assert(!haRegex.test('Hazzzah')); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches.md index d3675d1375..30a1df4d76 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches.md @@ -39,6 +39,7 @@ assert(ohRegex.source.match(/{.*?}/).length > 0); La expresión regular no debe coincidir con la cadena `Ohh no` ```js +ohRegex.lastIndex = 0; assert(!ohRegex.test('Ohh no')); ``` @@ -69,6 +70,7 @@ assert('Ohhhhhh no'.match(ohRegex)[0].length === 10); La expresión regular no debe coincidir con la cadena `Ohhhhhhh no` ```js +ohRegex.lastIndex = 0; assert(!ohRegex.test('Ohhhhhhh no')); ``` diff --git a/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/display-shapes-with-svg.md b/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/display-shapes-with-svg.md index 71a39ddaf1..b4133a4bd4 100644 --- a/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/display-shapes-with-svg.md +++ b/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/display-shapes-with-svg.md @@ -1,6 +1,6 @@ --- id: 587d7fa8367417b2b2512bcc -title: Display Shapes with SVG +title: Mostrar formas con SVG challengeType: 6 forumTopicId: 301485 dashedName: display-shapes-with-svg @@ -8,47 +8,47 @@ dashedName: display-shapes-with-svg # --description-- -The last challenge created an `svg` element with a given width and height, which was visible because it had a `background-color` applied to it in the `style` tag. The code made space for the given width and height. +El desafío anterior creó un elemento `svg` con un ancho y alto determinado, el cual era visible porque tenía un `background-color` aplicado a él en la etiqueta `style`. El código dejó espacio para el ancho y la altura dados. -The next step is to create a shape to put in the `svg` area. There are a number of supported shapes in SVG, such as rectangles and circles. They are used to display data. For example, a rectangle (``) SVG shape could create a bar in a bar chart. +El siguiente paso es crear una forma para poner en el área `svg`. Hay una serie de formas compatibles en SVG, como rectángulos y círculos. Se utilizan para mostrar datos. Por ejemplo, una forma SVG rectangular (``) podría crear una barra en un gráfico de barras. -When you place a shape into the `svg` area, you can specify where it goes with `x` and `y` coordinates. The origin point of (0, 0) is in the upper-left corner. Positive values for `x` push the shape to the right, and positive values for `y` push the shape down from the origin point. +Cuando colocas una forma en el área del `svg`, puedes especificar a donde va a ir con las coordenadas `x` asimismo `y`. El punto de origen (0, 0) está en la esquina superior izquierda. Los valores positivos de `x` empujan la forma a la derecha y los valores positivos para `y` empujan la forma hacia abajo desde el punto de origen. -To place a shape in the middle of the 500 (width) x 100 (height) `svg` from last challenge, the `x` coordinate would be 250 and the `y` coordinate would be 50. +Para colocar una forma en medio del `svg` de 500 (ancho) x 100 (altura) del último reto, la coordenada `x` sería 250 y la coordenada `y` sería 50. -An SVG `rect` has four attributes. There are the `x` and `y` coordinates for where it is placed in the `svg` area. It also has a `height` and `width` to specify the size. +Un rectángulo(`rect`) de SVG tiene cuatro atributos. Hay coordenadas `x` asimismo `y` para posicionarlo en el área del `svg`. También tiene un `height` (altura) y `width` (ancho) para especificar el tamaño. # --instructions-- -Add a `rect` shape to the `svg` using `append()`, and give it a `width` attribute of `25` and `height` attribute of `100`. Also, give the `rect` `x` and `y` attributes each set to `0`. +Añade una forma `rect` al `svg` usando `append()`, y dale un atributo `width` de `25` y un atributo `height` de `100`. Además, dale a `rect`, atributos `x` asimismo `y`, establece ambos valores en `0`. # --hints-- -Your document should have 1 `rect` element. +Tu documento debe tener un elemento `rect`. ```js assert($('rect').length == 1); ``` -The `rect` element should have a `width` attribute set to `25`. +El elemento `rect` debe tener un atributo `width` de `25`. ```js assert($('rect').attr('width') == '25'); ``` -The `rect` element should have a `height` attribute set to `100`. +El elemento `rect` debe tener un atributo `height` de `100`. ```js assert($('rect').attr('height') == '100'); ``` -The `rect` element should have an `x` attribute set to `0`. +El elemento `rect` debe tener un atributo `x` de `0`. ```js assert($('rect').attr('x') == '0'); ``` -The `rect` element should have a `y` attribute set to `0`. +El elemento `rect` debe tener un atributo `y` de `0`. ```js assert($('rect').attr('y') == '0'); diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.md index afc6592395..20ebda8362 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.md @@ -69,12 +69,14 @@ assert( La tua espressione regolare non dovrebbe riconoscere nessun criminale nella stringa vuota `""` ```js +reCriminals.lastIndex = 0; assert(!reCriminals.test('')); ``` La tua espressione regolare non dovrebbe riconoscere nessun criminale nella stringa `P1P2P3` ```js +reCriminals.lastIndex = 0; assert(!reCriminals.test('P1P2P3')); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.md index b130e448bc..a1ed8cb0fd 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.md @@ -23,60 +23,70 @@ Scrivi un'espressione regolare `fccRegex` per riconoscere `freeCodeCamp`, indipe La tua espressione regolare dovrebbe riconoscere la stringa `freeCodeCamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('freeCodeCamp')); ``` La tua espressione regolare dovrebbe riconoscere la stringa `FreeCodeCamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FreeCodeCamp')); ``` La tua espressione regolare dovrebbe riconoscere la stringa `FreecodeCamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FreecodeCamp')); ``` La tua espressione regolare dovrebbe riconoscere la stringa `FreeCodecamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FreeCodecamp')); ``` La tua espressione regolare non dovrebbe riconoscere la stringa `Free Code Camp` ```js +fccRegex.lastIndex = 0; assert(!fccRegex.test('Free Code Camp')); ``` La tua espressione regolare dovrebbe riconoscere la stringa `FreeCOdeCamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FreeCOdeCamp')); ``` La tua espressione regolare non dovrebbe riconoscere la stringa `FCC` ```js +fccRegex.lastIndex = 0; assert(!fccRegex.test('FCC')); ``` La tua espressione regolare dovrebbe riconoscere la stringa `FrEeCoDeCamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FrEeCoDeCamp')); ``` La tua espressione regolare dovrebbe riconoscere la stringa `FrEeCodECamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FrEeCodECamp')); ``` La tua espressione regolare dovrebbe riconoscere la stringa `FReeCodeCAmp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FReeCodeCAmp')); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.md index 53f55e6812..12e8c9ee09 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.md @@ -25,42 +25,49 @@ Completa l'espressione regolare `petRegex` per riconoscere gli animali domestici La tua espressione regolare `petRegex` dovrebbe restituire `true` per la stringa `John has a pet dog.` ```js +petRegex.lastIndex = 0; assert(petRegex.test('John has a pet dog.')); ``` La tua espressione regolare `petRegex` dovrebbe restituire `false` per la stringa `Emma has a pet rock.` ```js +petRegex.lastIndex = 0; assert(!petRegex.test('Emma has a pet rock.')); ``` La tua espressione regolare `petRegex` dovrebbe restituire `true` per la stringa `Emma has a pet bird.` ```js +petRegex.lastIndex = 0; assert(petRegex.test('Emma has a pet bird.')); ``` La tua espressione regolare `petRegex` dovrebbe restituire `true` per la stringa `Liz has a pet cat.` ```js +petRegex.lastIndex = 0; assert(petRegex.test('Liz has a pet cat.')); ``` La tua espressione regolare `petRegex` dovrebbe restituire `false` per la stringa `Kara has a pet dolphin.` ```js +petRegex.lastIndex = 0; assert(!petRegex.test('Kara has a pet dolphin.')); ``` La tua espressione regolare `petRegex` dovrebbe restituire `true` per la stringa `Alice has a pet fish.` ```js +petRegex.lastIndex = 0; assert(petRegex.test('Alice has a pet fish.')); ``` La tua espressione regolare `petRegex` dovrebbe restituire `false` per la stringa `Jimmy has a pet computer.` ```js +petRegex.lastIndex = 0; assert(!petRegex.test('Jimmy has a pet computer.')); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.md index 3419325e6f..2e023b3895 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.md @@ -43,12 +43,14 @@ assert(calRegex.flags == ''); La tua espressione regolare dovrebbe riconoscere `Cal` all'inizio della stringa. ```js +calRegex.lastIndex = 0; assert(calRegex.test('Cal and Ricky both like racing.')); ``` La tua espressione regolare non dovrebbe riconoscere `Cal` nel mezzo di una stringa. ```js +calRegex.lastIndex = 0; assert(!calRegex.test('Ricky and Cal both like racing.')); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.md index 959d7e5599..87fb486be3 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.md @@ -43,6 +43,7 @@ assert(lastRegex.flags == ''); Dovresti riconoscere `caboose` alla fine della stringa `The last car on a train is the caboose` ```js +lastRegex.lastIndex = 0; assert(lastRegex.test('The last car on a train is the caboose')); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md index 9b1175b521..7aeef42952 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md @@ -38,12 +38,14 @@ Completa l'espressione regolare `waldoRegex` per trovare `"Waldo"` nella stringa La tua espressione regolare `waldoRegex` dovrebbe trovare la stringa `Waldo` ```js +waldoRegex.lastIndex = 0; assert(waldoRegex.test(waldoIsHiding)); ``` La tua espressione regolare `waldoRegex` non dovrebbe cercare altro. ```js +waldoRegex.lastIndex = 0; assert(!waldoRegex.test('Somewhere is hiding in this text.')); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.md index fa07817ec6..ad73a4aa5e 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.md @@ -52,48 +52,56 @@ assert(pwRegex.source.match(/\(\?=.*?\)\(\?=.*?\)/) !== null); La tua espressione regolare non dovrebbe corrispondere alla stringa `astronaut` ```js +pwRegex.lastIndex = 0; assert(!pwRegex.test('astronaut')); ``` La tua espressione regolare non dovrebbe riconoscere la stringa `banan1` ```js +pwRegex.lastIndex = 0; assert(!pwRegex.test('banan1')); ``` La tua espressione regolare dovrebbe riconoscere la stringa `bana12` ```js +pwRegex.lastIndex = 0; assert(pwRegex.test('bana12')); ``` La tua espressione regolare dovrebbe riconoscere la stringa `abc123` ```js +pwRegex.lastIndex = 0; assert(pwRegex.test('abc123')); ``` La tua espressione regolare non dovrebbe riconoscere la stringa `12345` ```js +pwRegex.lastIndex = 0; assert(!pwRegex.test('12345')); ``` La tua espressione regolare dovrebbe riconoscere la stringa `8pass99` ```js +pwRegex.lastIndex = 0; assert(pwRegex.test('8pass99')); ``` La tua espressione regolare non dovrebbe riconoscere la stringa `1a2bcde` ```js +pwRegex.lastIndex = 0; assert(!pwRegex.test('1a2bcde')); ``` La tua espressione regolare dovrebbe riconoscere la stringa `astr1on11aut` ```js +pwRegex.lastIndex = 0; assert(pwRegex.test('astr1on11aut')); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/restrict-possible-usernames.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/restrict-possible-usernames.md index 7cad83de5b..346618e40a 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/restrict-possible-usernames.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/restrict-possible-usernames.md @@ -29,78 +29,91 @@ Cambia l'espressione regolare `userCheck` in modo che corrisponda ai vincoli ele La tua espressione regolare dovrebbe riconoscere la stringa `JACK` ```js +userCheck.lastIndex = 0; assert(userCheck.test('JACK')); ``` La tua espressione regolare non dovrebbe riconoscere la stringa `J` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('J')); ``` La tua espressione regolare dovrebbe riconoscere la stringa `Jo` ```js +userCheck.lastIndex = 0; assert(userCheck.test('Jo')); ``` La tua espressione regolare dovrebbe riconoscere la stringa `Oceans11` ```js +userCheck.lastIndex = 0; assert(userCheck.test('Oceans11')); ``` La tua espressione regolare dovrebbe riconoscere la stringa `RegexGuru` ```js +userCheck.lastIndex = 0; assert(userCheck.test('RegexGuru')); ``` La tua espressione regolare non dovrebbe riconoscere la stringa `007` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('007')); ``` La tua espressione regolare non dovrebbe riconoscere la stringa `9` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('9')); ``` La tua espressione regolare non dovrebbe riconoscere la stringa `A1` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('A1')); ``` La tua espressione regolare non dovrebbe riconoscere la stringa `BadUs3rnam3` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('BadUs3rnam3')); ``` La tua espressione regolare dovrebbe riconoscere la stringa `Z97` ```js +userCheck.lastIndex = 0; assert(userCheck.test('Z97')); ``` La tua espressione regolare non dovrebbe riconoscere la stringa `c57bT3` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('c57bT3')); ``` La tua espressione regolare dovrebbe riconoscere la stringa `AB1` ```js +userCheck.lastIndex = 0; assert(userCheck.test('AB1')); ``` La tua espressione regolare non dovrebbe riconoscere la stringa `J%4` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('J%4')) ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.md index 407499a2a4..9862042c06 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.md @@ -52,12 +52,14 @@ assert(reRegex.source.match(/\\1|\\2/g).length >= 2); La tua espressione regolare dovrebbe riconoscere la stringa `42 42 42`. ```js +reRegex.lastIndex = 0; assert(reRegex.test('42 42 42')); ``` La tua espressione regolare dovrebbe riconoscere la stringa `100 100 100`. ```js +reRegex.lastIndex = 0; assert(reRegex.test('100 100 100')); ``` @@ -76,18 +78,21 @@ assert.equal('42 42'.match(reRegex.source), null); La tua espressione regolare non dovrebbe riconoscere la stringa `101 102 103`. ```js +reRegex.lastIndex = 0; assert(!reRegex.test('101 102 103')); ``` La tua espressione regolare non dovrebbe riconoscere la stringa `1 2 3`. ```js +reRegex.lastIndex = 0; assert(!reRegex.test('1 2 3')); ``` La tua espressione regolare dovrebbe riconoscere la stringa `10 10 10`. ```js +reRegex.lastIndex = 0; assert(reRegex.test('10 10 10')); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/specify-only-the-lower-number-of-matches.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/specify-only-the-lower-number-of-matches.md index e9e2ecc15c..ddd66170cd 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/specify-only-the-lower-number-of-matches.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/specify-only-the-lower-number-of-matches.md @@ -41,12 +41,14 @@ assert(haRegex.source.match(/{.*?}/).length > 0); La tua espressione regolare non dovrebbe riconoscere la stringa `Hazzah` ```js +haRegex.lastIndex = 0; assert(!haRegex.test('Hazzah')); ``` La tua espressione regolare non dovrebbe riconoscere la stringa `Hazzzah` ```js +haRegex.lastIndex = 0; assert(!haRegex.test('Hazzzah')); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches.md index dc56f94186..c8fd1eda94 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches.md @@ -39,6 +39,7 @@ assert(ohRegex.source.match(/{.*?}/).length > 0); La tua espressione regolare non dovrebbe riconoscere la stringa `Ohh no` ```js +ohRegex.lastIndex = 0; assert(!ohRegex.test('Ohh no')); ``` @@ -69,6 +70,7 @@ assert('Ohhhhhh no'.match(ohRegex)[0].length === 10); La tua espressione regolare non dovrebbe riconoscere la stringa `Ohhhhhhh no` ```js +ohRegex.lastIndex = 0; assert(!ohRegex.test('Ohhhhhhh no')); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.md index f83eb051db..8b1f578ab3 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.md @@ -69,12 +69,14 @@ assert( A regex não deve encontrar nenhum criminoso na string vazia `""` ```js +reCriminals.lastIndex = 0; assert(!reCriminals.test('')); ``` A regex não deve encontrar nenhum criminoso na string `P1P2P3` ```js +reCriminals.lastIndex = 0; assert(!reCriminals.test('P1P2P3')); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.md index 349f1ed14f..0adeced337 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.md @@ -23,60 +23,70 @@ Escreva uma regex `fccRegex` que encontre `freeCodeCamp`, não importa em que ca A regex deve encontrar a string `freeCodeCamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('freeCodeCamp')); ``` A regex deve encontrar a string `FreeCodeCamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FreeCodeCamp')); ``` A regex deve encontrar a string `FreecodeCamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FreecodeCamp')); ``` A regex deve encontrar a string `FreeCodecamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FreeCodecamp')); ``` A regex não deve encontrar a string `Free Code Camp` ```js +fccRegex.lastIndex = 0; assert(!fccRegex.test('Free Code Camp')); ``` A regex deve encontrar a string `FreeCOdeCamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FreeCOdeCamp')); ``` A regex não deve encontrar a string `FCC` ```js +fccRegex.lastIndex = 0; assert(!fccRegex.test('FCC')); ``` A regex deve encontrar a string `FrEeCoDeCamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FrEeCoDeCamp')); ``` A regex deve encontrar a string `FrEeCodECamp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FrEeCodECamp')); ``` A regex deve encontrar a string `FReeCodeCAmp` ```js +fccRegex.lastIndex = 0; assert(fccRegex.test('FReeCodeCAmp')); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.md index 77c1b0e3da..b965dc8df4 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.md @@ -25,42 +25,49 @@ Complete a regex `petRegex` para encontrar os pets `dog`, `cat`, `bird`, ou `fis A regex `petRegex` deve retornar `true` para a string `John has a pet dog.` ```js +petRegex.lastIndex = 0; assert(petRegex.test('John has a pet dog.')); ``` A regex `petRegex` deve retornar `false` para a string `Emma has a pet rock.` ```js +petRegex.lastIndex = 0; assert(!petRegex.test('Emma has a pet rock.')); ``` A regex `petRegex` deve retornar `true` para a string `Emma has a pet bird.` ```js +petRegex.lastIndex = 0; assert(petRegex.test('Emma has a pet bird.')); ``` A regex `petRegex` deve retornar `true` para a string `Liz has a pet cat.` ```js +petRegex.lastIndex = 0; assert(petRegex.test('Liz has a pet cat.')); ``` A regex `petRegex` deve retornar `false` para a string `Kara has a pet dolphin.` ```js +petRegex.lastIndex = 0; assert(!petRegex.test('Kara has a pet dolphin.')); ``` A regex `petRegex` deve retornar `true` para a string `Alice has a pet fish.` ```js +petRegex.lastIndex = 0; assert(petRegex.test('Alice has a pet fish.')); ``` A regex `petRegex` deve retornar `false` para a string `Jimmy has a pet computer.` ```js +petRegex.lastIndex = 0; assert(!petRegex.test('Jimmy has a pet computer.')); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.md index f71a60d4b6..12d33b7e18 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.md @@ -43,12 +43,14 @@ assert(calRegex.flags == ''); A regex deve capturar a string `Cal` no começo de uma string. ```js +calRegex.lastIndex = 0; assert(calRegex.test('Cal and Ricky both like racing.')); ``` A regex não deve capturar a string `Cal` no meio de uma string. ```js +calRegex.lastIndex = 0; assert(!calRegex.test('Ricky and Cal both like racing.')); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.md index 493c951751..3100760140 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.md @@ -43,6 +43,7 @@ assert(lastRegex.flags == ''); Você deve capturar `caboose` no fim da string `The last car on a train is the caboose` ```js +lastRegex.lastIndex = 0; assert(lastRegex.test('The last car on a train is the caboose')); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md index 46feafbe11..0a7242637e 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md @@ -38,12 +38,14 @@ Complete a regex `waldoRegex` para encontrar `"Waldo"` na string `waldoIsHiding` A regex `waldoRegex` deve encontrar a string `Waldo` ```js +waldoRegex.lastIndex = 0; assert(waldoRegex.test(waldoIsHiding)); ``` A regex `waldoRegex` não deve buscar nada além disso. ```js +waldoRegex.lastIndex = 0; assert(!waldoRegex.test('Somewhere is hiding in this text.')); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.md index f2e8912f04..196fb9fbf1 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.md @@ -52,48 +52,56 @@ assert(pwRegex.source.match(/\(\?=.*?\)\(\?=.*?\)/) !== null); A regex não deve encontrar a string `astronaut` ```js +pwRegex.lastIndex = 0; assert(!pwRegex.test('astronaut')); ``` A regex não deve encontrar a string `banan1` ```js +pwRegex.lastIndex = 0; assert(!pwRegex.test('banan1')); ``` A regex deve encontrar a string `bana12` ```js +pwRegex.lastIndex = 0; assert(pwRegex.test('bana12')); ``` A regex deve encontrar a string `abc123` ```js +pwRegex.lastIndex = 0; assert(pwRegex.test('abc123')); ``` A regex não deve encontrar a string `12345` ```js +pwRegex.lastIndex = 0; assert(!pwRegex.test('12345')); ``` A regex deve encontrar a string `8pass99` ```js +pwRegex.lastIndex = 0; assert(pwRegex.test('8pass99')); ``` A regex não deve encontrar a string `1a2bcde` ```js +pwRegex.lastIndex = 0; assert(!pwRegex.test('1a2bcde')); ``` A regex deve encontrar a string `astr1on11aut` ```js +pwRegex.lastIndex = 0; assert(pwRegex.test('astr1on11aut')); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/restrict-possible-usernames.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/restrict-possible-usernames.md index cf571ff118..472a4e2483 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/restrict-possible-usernames.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/restrict-possible-usernames.md @@ -29,78 +29,91 @@ Modifique a regex `userCheck` para que inclua as regras listadas. A regex deve encontrar a string `JACK` ```js +userCheck.lastIndex = 0; assert(userCheck.test('JACK')); ``` A regex não deve encontrar a string `J` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('J')); ``` A regex deve encontrar a string `Jo` ```js +userCheck.lastIndex = 0; assert(userCheck.test('Jo')); ``` A regex deve encontrar a string `Oceans11` ```js +userCheck.lastIndex = 0; assert(userCheck.test('Oceans11')); ``` A regex deve encontrar a string `RegexGuru` ```js +userCheck.lastIndex = 0; assert(userCheck.test('RegexGuru')); ``` A regex não deve encontrar a string `007` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('007')); ``` A regex não deve encontrar a string `9` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('9')); ``` A regex não deve encontrar a string `A1` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('A1')); ``` A regex não deve encontrar a string `BadUs3rnam3` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('BadUs3rnam3')); ``` A regex deve encontrar a string `Z97` ```js +userCheck.lastIndex = 0; assert(userCheck.test('Z97')); ``` A regex não deve encontrar a string `c57bT3` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('c57bT3')); ``` A regex deve encontrar a string `AB1` ```js +userCheck.lastIndex = 0; assert(userCheck.test('AB1')); ``` A regex não deve encontrar a string `J%4` ```js +userCheck.lastIndex = 0; assert(!userCheck.test('J%4')) ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.md index a05c2bfbc4..e9584035ce 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.md @@ -52,12 +52,14 @@ assert(reRegex.source.match(/\\1|\\2/g).length >= 2); A regex deve encontrar a string `42 42 42`. ```js +reRegex.lastIndex = 0; assert(reRegex.test('42 42 42')); ``` A regex deve encontrar a string `100 100 100`. ```js +reRegex.lastIndex = 0; assert(reRegex.test('100 100 100')); ``` @@ -76,18 +78,21 @@ assert.equal('42 42'.match(reRegex.source), null); A regex não deve encontrar a string `101 102 103`. ```js +reRegex.lastIndex = 0; assert(!reRegex.test('101 102 103')); ``` A regex não deve encontrar a string `1 2 3`. ```js +reRegex.lastIndex = 0; assert(!reRegex.test('1 2 3')); ``` A regex deve encontrar a string `10 10 10`. ```js +reRegex.lastIndex = 0; assert(reRegex.test('10 10 10')); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-only-the-lower-number-of-matches.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-only-the-lower-number-of-matches.md index 449013b1ab..25982b7f8f 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-only-the-lower-number-of-matches.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-only-the-lower-number-of-matches.md @@ -41,12 +41,14 @@ assert(haRegex.source.match(/{.*?}/).length > 0); A regex não deve encontrar a string `Hazzah` ```js +haRegex.lastIndex = 0; assert(!haRegex.test('Hazzah')); ``` A regex não deve encontrar a string `Hazzzah` ```js +haRegex.lastIndex = 0; assert(!haRegex.test('Hazzzah')); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches.md index b62ab7230d..6709bd4667 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches.md @@ -39,6 +39,7 @@ assert(ohRegex.source.match(/{.*?}/).length > 0); A regex não deve encontrar a string `Ohh no` ```js +ohRegex.lastIndex = 0; assert(!ohRegex.test('Ohh no')); ``` @@ -69,6 +70,7 @@ assert('Ohhhhhh no'.match(ohRegex)[0].length === 10); A regex não deve encontrar a string `Ohhhhhhh no` ```js +ohRegex.lastIndex = 0; assert(!ohRegex.test('Ohhhhhhh no')); ```