fix: added 22 missing solutions (#35747)
This commit is contained in:
		
				
					committed by
					
						 Oliver Eyton-Williams
						Oliver Eyton-Williams
					
				
			
			
				
	
			
			
			
						parent
						
							b9fdbffa71
						
					
				
				
					commit
					a092c76688
				
			| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user