fix: added 22 missing solutions (#35747)

This commit is contained in:
Randell Dawson
2019-05-03 03:05:26 -07:00
committed by Oliver Eyton-Williams
parent b9fdbffa71
commit a092c76688
22 changed files with 73 additions and 22 deletions

View File

@ -53,6 +53,8 @@ let result = extractStr; // Change this line
<section id='solution'>
```js
// solution required
let extractStr = "Extract the word 'coding' from this string.";
let codingRegex = /coding/; // Change this line
let result = extractStr.match(codingRegex); // Change this line
```
</section>

View File

@ -51,6 +51,8 @@ let result = text.match(myRegex);
<section id='solution'>
```js
// solution required
let text = "<h1>Winter is coming</h1>";
let myRegex = /<.*?>/; // Change this line
let result = text.match(myRegex);
```
</section>

View File

@ -68,6 +68,12 @@ console.log(matchedCriminals);
<section id='solution'>
```js
// solution required
// example crowd gathering
let crowd = 'P1P2P3P4P5P6CCCP7P8P9';
let reCriminals = /C+/; // Change this line
let matchedCriminals = crowd.match(reCriminals);
```
</section>

View File

@ -67,6 +67,8 @@ let result = fccRegex.test(myString);
<section id='solution'>
```js
// solution required
let myString = "freeCodeCamp";
let fccRegex = /freecodecamp/i; // Change this line
let result = fccRegex.test(myString);
```
</section>

View File

@ -62,6 +62,8 @@ let result = petRegex.test(petString);
<section id='solution'>
```js
// solution required
let petString = "James has a pet cat.";
let petRegex = /dog|cat|bird|fish/; // Change this line
let result = petRegex.test(petString);
```
</section>

View File

@ -60,6 +60,8 @@ let result = quoteSample.match(alphabetRegexV2).length;
<section id='solution'>
```js
// solution required
let quoteSample = "The five boxing wizards jump quickly.";
let alphabetRegexV2 = /\w/g; // Change this line
let result = quoteSample.match(alphabetRegexV2).length;
```
</section>

View File

@ -62,6 +62,8 @@ let result = numString.match(noNumRegex).length;
<section id='solution'>
```js
// solution required
let numString = "Your sandwich will be $5.00";
let noNumRegex = /\D/g; // Change this line
let result = numString.match(noNumRegex).length;
```
</section>

View File

@ -62,6 +62,9 @@ let result = numString.match(numRegex).length;
<section id='solution'>
```js
// solution required
let numString = "Your sandwich will be $5.00";
let numRegex = /\d/g; // Change this line
let result = numString.match(numRegex).length;
```
</section>

View File

@ -67,6 +67,8 @@ let result = unRegex.test(exampleStr);
<section id='solution'>
```js
// solution required
let exampleStr = "Let's have fun with regular expressions!";
let unRegex = /.un/; // Change this line
let result = unRegex.test(exampleStr);
```
</section>

View File

@ -55,6 +55,8 @@ let result = calRegex.test(rickyAndCal);
<section id='solution'>
```js
// solution required
let rickyAndCal = "Cal and Ricky both like racing.";
let calRegex = /^Cal/; // Change this line
let result = calRegex.test(rickyAndCal);
```
</section>

View File

@ -53,6 +53,8 @@ let result = lastRegex.test(caboose);
<section id='solution'>
```js
// solution required
let caboose = "The last car on a train is the caboose";
let lastRegex = /caboose$/; // Change this line
let result = lastRegex.test(caboose);
```
</section>

View File

@ -59,6 +59,8 @@ let result = quoteSample.match(nonAlphabetRegex).length;
<section id='solution'>
```js
// solution required
let quoteSample = "The five boxing wizards_jump quickly.";
let nonAlphabetRegex = /\W/g; // Change this line
let result = quoteSample.match(nonAlphabetRegex).length;
```
</section>

View File

@ -55,6 +55,8 @@ let result = alphabetRegex; // Change this line
<section id='solution'>
```js
// solution required
let quoteSample = "The quick brown fox jumps over the lazy dog.";
let alphabetRegex = /[a-z]/gi; // Change this line
let result = quoteSample.match(alphabetRegex); // Change this line
```
</section>

View File

@ -55,6 +55,8 @@ let result = waldoRegex.test(waldoIsHiding);
<section id='solution'>
```js
// solution required
let waldoIsHiding = "Somewhere Waldo is hiding in this text.";
let waldoRegex = /Waldo/; // Change this line
let result = waldoRegex.test(waldoIsHiding);
```
</section>

View File

@ -57,6 +57,8 @@ let result = sample.match(countNonWhiteSpace);
<section id='solution'>
```js
// solution required
let sample = "Whitespace is important in separating words";
let countNonWhiteSpace = /\S/g; // Change this line
let result = sample.match(countNonWhiteSpace);
```
</section>

View File

@ -54,6 +54,9 @@ let result = myRegex; // Change this line
<section id='solution'>
```js
// solution required
let quoteSample = "Blueberry 3.141592653s are delicious.";
let myRegex = /[h-s2-6]/gi; // Change this line
let result = quoteSample.match(myRegex); // Change this line
```
</section>

View File

@ -59,6 +59,8 @@ let result = vowelRegex; // Change this line
<section id='solution'>
```js
// solution required
let quoteSample = "Beware of bugs in the above code; I have only proved it correct, not tried it.";
let vowelRegex = /[aeiou]/gi; // Change this line
let result = quoteSample.match(vowelRegex); // Change this line
```
</section>

View File

@ -53,6 +53,8 @@ let result = myRegex; // Change this line
<section id='solution'>
```js
// solution required
let quoteSample = "3 blind mice.";
let myRegex = /[^0-9aeiou]/gi; // Change this line
let result = quoteSample.match(myRegex); // Change this line
```
</section>

View File

@ -62,6 +62,8 @@ let result = haRegex.test(haStr);
<section id='solution'>
```js
// solution required
let haStr = "Hazzzzah";
let haRegex = /z{4,}/; // Change this line
let result = haRegex.test(haStr);
```
</section>

View File

@ -62,6 +62,8 @@ let result = ohRegex.test(ohStr);
<section id='solution'>
```js
// solution required
let ohStr = "Ohhh no";
let ohRegex = /Oh{3,6} no/; // Change this line
let result = ohRegex.test(ohStr);
```
</section>

View File

@ -56,6 +56,9 @@ let result = huhText.replace(fixRegex, replaceText);
<section id='solution'>
```js
// solution required
let huhText = "This sandwich is good.";
let fixRegex = /good/g; // Change this line
let replaceText = "okey-dokey"; // Change this line
let result = huhText.replace(fixRegex, replaceText);
```
</section>

View File

@ -52,6 +52,8 @@ let result = myRegex; // Change this line
<section id='solution'>
```js
// solution required
let myString = "Hello, World!";
let myRegex = /Hello/;
let result = myRegex.test(myString); // Change this line
```
</section>