Merge pull request #1787 from KuthumiPepple/patch-1

fix typo
This commit is contained in:
Ilya Kantor 2020-03-21 09:15:12 +03:00 committed by GitHub
commit 4995823c91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,6 @@
# Character classes # Character classes
Consider a practical task -- we have a phone number like `"+7(903)-123-45-67"`, and we need to turn it into pure numbers: `79035419441`. Consider a practical task -- we have a phone number like `"+7(903)-123-45-67"`, and we need to turn it into pure numbers: `79031234567`.
To do so, we can find and remove anything that's not a number. Character classes can help with that. To do so, we can find and remove anything that's not a number. Character classes can help with that.
@ -30,7 +30,7 @@ let regexp = /\d/g;
alert( str.match(regexp) ); // array of matches: 7,9,0,3,1,2,3,4,5,6,7 alert( str.match(regexp) ); // array of matches: 7,9,0,3,1,2,3,4,5,6,7
// let's make the digits-only phone number of them: // let's make the digits-only phone number of them:
alert( str.match(regexp).join('') ); // 79035419441 alert( str.match(regexp).join('') ); // 79031234567
``` ```
That was a character class for digits. There are other character classes as well. That was a character class for digits. There are other character classes as well.