Skip to content

Commit

Permalink
Merge pull request freeCodeCamp#2490 from abhisekp/patch-3
Browse files Browse the repository at this point in the history
Add correction to Waypoint - Sift through Text with Regular Expressions
  • Loading branch information
benmcmahon100 committed Aug 30, 2015
2 parents d6fde0c + a2db581 commit 20d58b5
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions seed/challenges/basic-javascript.json
Original file line number Diff line number Diff line change
Expand Up @@ -1000,26 +1000,25 @@
"difficulty":"9.984",
"description":[
"<code>Regular expressions</code> are used to find certain words or patterns inside of <code>strings</code>.",
"For example, if we wanted to find the number of times the word <code>the</code> occurred in the string <code>The dog chased the cat</code>, we could use the following <code>regular expression</code>: <code>\/the+\/gi</code>",
"For example, if we wanted to find the word <code>the</code> in the string <code>The dog chased the cat</code>, we could use the following <code>regular expression</code>: <code>\/the\/gi</code>",
"Let's break this down a bit:",
"<code>the</code> is the pattern we want to match.",
"<code>+</code> means we want to find one or more occurrences of this pattern.",
"<code>g</code> means that we want to search the entire string for this pattern.",
"<code>g</code> means that we want to search the entire string for this pattern instead of just the first match.",
"<code>i</code> means that we want to ignore the case (uppercase or lowercase) when searching for the pattern.",
"<code>Regular expressions</code> are usually surrounded by <code>/</code> symbols.",
"Let's try selecting all the occurrences of the word <code>and</code> in the string <code>George Boole and Alan Turing went to the shop and got some milk</code>. We can do this by replacing the <code>.</code> part of our regular expression with the word <code>and</code>."
"<code>Regular expressions</code> are written by surrounding the pattern with a <code>/</code> symbol.",
"Let's try selecting all the occurrences of the word <code>and</code> in the string <code>George Boole and Alan Turing went to the shop and got some milk</code>. We can do this by replacing the <code>...</code> part of our regular expression with the current <code>regular expression</code> with the word <code>and</code>."
],
"tests":[
"assert(test==2, 'Your <code>regular expression</code> should find two occurrences of the word <code>and</code>');",
"assert(editor.getValue().match(/\\/and\\+\\/gi/), 'You should have used <code>regular expressions</code> to find the word <code>and</code>');"
"assert(editor.getValue().match(/\\/and\\/gi/), 'You should have used <code>regular expressions</code> to find the word <code>and</code>');"
],
"challengeSeed":[
"var test = (function() {",
" var testString = \"George Boole and Alan Turing went to the shop and got some milk\";",
" 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.",
Expand Down

0 comments on commit 20d58b5

Please sign in to comment.