Skip to content

Commit 2cf95d8

Browse files
committed
Fix some issues in 9.2 (Character classes)
* Fix typos. * Update a support note. * Add a reference for a yet unexplained pattern.
1 parent e87f130 commit 2cf95d8

File tree

1 file changed

+6
-6
lines changed
  • 9-regular-expressions/02-regexp-character-classes

1 file changed

+6
-6
lines changed

9-regular-expressions/02-regexp-character-classes/article.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ A *character class* is a special notation that matches any symbol from a certain
88

99
For the start, let's explore the "digit" class. It's written as `pattern:\d` and corresponds to "any single digit".
1010

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:
1212

1313
```js run
1414
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
144144
alert( "A\nB".match(/A.B/s) ); // A\nB (match!)
145145
```
146146

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.
149149
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>).
151151
152152
```js run
153153
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
179179
180180
**A space is a character. Equal in importance with any other character.**
181181
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.
183183
184184
In other words, in a regular expression all characters matter, spaces too.
185185
````
@@ -198,6 +198,6 @@ There exist following character classes:
198198

199199
...But that's not all!
200200

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.
202202

203203
We can search by these properties as well. That requires flag `pattern:u`, covered in the next article.

0 commit comments

Comments
 (0)