diff --git a/9-regular-expressions/02-regexp-character-classes/article.md b/9-regular-expressions/02-regexp-character-classes/article.md index 93552a2b..201c78a0 100644 --- a/9-regular-expressions/02-regexp-character-classes/article.md +++ b/9-regular-expressions/02-regexp-character-classes/article.md @@ -8,7 +8,7 @@ A *character class* is a special notation that matches any symbol from a certain For the start, let's explore the "digit" class. It's written as `pattern:\d` and corresponds to "any single digit". -For instance, the let's find the first digit in the phone number: +For instance, let's find the first digit in the phone number: ```js run let str = "+7(903)-123-45-67"; @@ -144,10 +144,10 @@ That's what flag `pattern:s` does. If a regexp has it, then a dot `pattern:.` ma alert( "A\nB".match(/A.B/s) ); // A\nB (match!) ``` -````warn header="Not supported in Firefox, IE, Edge" -Check for the most recent state of support. At the time of writing it doesn't include Firefox, IE, Edge. +````warn header="Not supported in IE" +The `pattern:s` flag is not supported in IE. -Luckily, there's an alternative, that works everywhere. We can use a regexp like `pattern:[\s\S]` to match "any character". +Luckily, there's an alternative, that works everywhere. We can use a regexp like `pattern:[\s\S]` to match "any character" (this pattern will be covered in the article ). ```js run alert( "A\nB".match(/A[\s\S]B/) ); // A\nB (match!) @@ -179,7 +179,7 @@ alert( "1 - 5".match(/\d\s-\s\d/) ); // 1 - 5, also works **A space is a character. Equal in importance with any other character.** -We can't add or remove spaces from a regular expression and expect to work the same. +We can't add or remove spaces from a regular expression and expect it to work the same. In other words, in a regular expression all characters matter, spaces too. ```` @@ -198,6 +198,6 @@ There exist following character classes: ...But that's not all! -Unicode encoding, used by JavaScript for strings, provides many properties for characters, like: which language the letter belongs to (if it's a letter) it is it a punctuation sign, etc. +Unicode encoding, used by JavaScript for strings, provides many properties for characters, like: which language the letter belongs to (if it's a letter), is it a punctuation sign, etc. We can search by these properties as well. That requires flag `pattern:u`, covered in the next article.