From c5c68c252c4980b9b0489874a8b44500960533c8 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sat, 22 Aug 2015 19:05:41 +0530 Subject: [PATCH] Correct Sift through Text with Regular Expressions - Change information text - Change regular expression - Change code in editor - Change assertion --- seed/challenges/basic-javascript.json | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/seed/challenges/basic-javascript.json b/seed/challenges/basic-javascript.json index ac835890ea..82e1dfb639 100644 --- a/seed/challenges/basic-javascript.json +++ b/seed/challenges/basic-javascript.json @@ -999,18 +999,17 @@ "difficulty":"9.984", "description":[ "Regular expressions are used to find certain words or patterns inside of strings.", - "For example, if we wanted to find the number of times the word the occurred in the string The dog chased the cat, we could use the following regular expression: \/the+\/gi", + "For example, if we wanted to find the word the in the string The dog chased the cat, we could use the following regular expression: \/the\/gi", "Let's break this down a bit:", "the is the pattern we want to match.", - "+ means we want to find one or more occurrences of this pattern.", - "g means that we want to search the entire string for this pattern.", + "g means that we want to search the entire string for this pattern instead of just the first match.", "i means that we want to ignore the case (uppercase or lowercase) when searching for the pattern.", - "Regular expressions are usually surrounded by / symbols.", - "Let's try selecting all the occurrences of the word and in the string George Boole and Alan Turing went to the shop and got some milk. We can do this by replacing the .+ part of our regular expression with the current regular expression with the word and." + "Regular expressions are written by surrounding the pattern with a / symbol.", + "Let's try selecting all the occurrences of the word and in the string George Boole and Alan Turing went to the shop and got some milk. We can do this by replacing the ... part of our regular expression with the current regular expression with the word and." ], "tests":[ "assert(test==2, 'Your regular expression should find two occurrences of the word and');", - "assert(editor.getValue().match(/\\/and\\+\\/gi/), 'You should have used regular expressions to find the word and');" + "assert(editor.getValue().match(/\\/and\\/gi/), 'You should have used regular expressions to find the word and');" ], "challengeSeed":[ "var test = (function() {", @@ -1018,7 +1017,7 @@ " var expressionToGetMilk = /milk/gi;", " // Only change code below this line.", "", - " var expression = /.+/gi;", + " var expression = /.../gi;", "", " // Only change code above this line.", " // We use this function to show you the value of your variable in your output box.",