You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 9-regular-expressions/02-regexp-character-classes/article.md
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ A *character class* is a special notation that matches any symbol from a certain
8
8
9
9
For the start, let's explore the "digit" class. It's written as `pattern:\d` and corresponds to "any single digit".
10
10
11
-
For instance, the let's find the first digit in the phone number:
11
+
For instance, let's find the first digit in the phone number:
12
12
13
13
```js run
14
14
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
144
144
alert( "A\nB".match(/A.B/s) ); // A\nB (match!)
145
145
```
146
146
147
-
````warn header="Not supported in Firefox, IE, Edge"
148
-
Check <https://caniuse.com/#search=dotall> for the most recent state of support. At the time of writing it doesn't include Firefox, IE, Edge.
147
+
````warn header="Not supported in IE"
148
+
The `pattern:s` flag is not supported in IE.
149
149
150
-
Luckily, there's an alternative, that works everywhere. We can use a regexp like `pattern:[\s\S]` to match "any character".
150
+
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 <info:regexp-character-sets-and-ranges>).
@@ -179,7 +179,7 @@ alert( "1 - 5".match(/\d\s-\s\d/) ); // 1 - 5, also works
179
179
180
180
**A space is a character. Equal in importance with any other character.**
181
181
182
-
We can't add or remove spaces from a regular expression and expect to work the same.
182
+
We can't add or remove spaces from a regular expression and expect it to work the same.
183
183
184
184
In other words, in a regular expression all characters matter, spaces too.
185
185
````
@@ -198,6 +198,6 @@ There exist following character classes:
198
198
199
199
...But that's not all!
200
200
201
-
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.
201
+
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.
202
202
203
203
We can search by these properties as well. That requires flag `pattern:u`, covered in the next article.
0 commit comments