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.
This commit is contained in:
Nick Haras
2018-10-23 15:10:40 +03:00
committed by Tom
parent edf7a5f781
commit 5e951090bf

View File

@ -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
```