From 5e951090bf29e1c1ce6743478bbfd04ad6f414f5 Mon Sep 17 00:00:00 2001 From: Nick Haras Date: Tue, 23 Oct 2018 15:10:40 +0300 Subject: [PATCH] Corrected the example regular expressions. (#19615) * Corrected the example regular expressions. Removed the extra spaces from inside the regex at lines 44-45 and 56 - 58. Spaces do not affect JS commands but make a difference inside a regex. The way they were the examples did not return true. * Fixed reviewer's suggestions Revert the test back in line 58. Remove unnecessary spaces in lines 56, 58. --- .../javascript/regular-expressions-reference/index.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/guide/english/javascript/regular-expressions-reference/index.md b/guide/english/javascript/regular-expressions-reference/index.md index 92c0615edb..d3871f2a00 100644 --- a/guide/english/javascript/regular-expressions-reference/index.md +++ b/guide/english/javascript/regular-expressions-reference/index.md @@ -41,8 +41,8 @@ with the RegExp constructor or written as a literal value by enclosing the pattern in forward slash ( / ) characters. ``` -var re1 = new RegExp (" abc ") ; -var re2 = / abc /; +var re1 = new RegExp("abc") ; +var re2 = /abc/; ``` Both of these regular expression objects represent the same pattern: an a character followed by a b followed by a c. @@ -53,9 +53,9 @@ a character followed by a b followed by a c. ### Testing for matches ``` -console . log (/ abc /. test (" abcde ") ); +console.log(/abc/.test(" abcde ")); // → true -console . log (/ abc /. test (" abxde ") ); +console.log(/ abc /.test(" abxde ")); // → false ```