@@ -154,12 +154,12 @@ as `[0-9]`.
154
154
| ` \S ` | A nonwhitespace character
155
155
| ` . ` | Any character except for newline
156
156
157
- So you could match a ((date)) and ((time)) format like 30-01 -2003
157
+ So you could match a ((date)) and ((time)) format like 01-30 -2003
158
158
15:20 with the following expression:
159
159
160
160
```
161
161
let dateTime = /\d\d-\d\d-\d\d\d\d \d\d:\d\d/;
162
- console.log(dateTime.test("30-01 -2003 15:20"));
162
+ console.log(dateTime.test("01-30 -2003 15:20"));
163
163
// → true
164
164
console.log(dateTime.test("30-jan-2003 15:20"));
165
165
// → false
@@ -255,7 +255,7 @@ is also slightly easier to decipher.
255
255
256
256
```
257
257
let dateTime = /\d{1,2}-\d{1,2}-\d{4} \d{1,2}:\d{2}/;
258
- console.log(dateTime.test("30-1 -2003 8:45"));
258
+ console.log(dateTime.test("1-30 -2003 8:45"));
259
259
// → true
260
260
```
261
261
@@ -424,8 +424,8 @@ millisecond count by creating a new `Date` object and calling
424
424
425
425
Date objects provide methods like ` getFullYear ` , ` getMonth ` ,
426
426
` getDate ` , ` getHours ` , ` getMinutes ` , and ` getSeconds ` to extract their
427
- components. Besides ` getFullYear ` , there's also ` getYear ` , which gives
428
- you a rather useless two-digit year value (such as ` 93 ` or ` 14 ` ) .
427
+ components. Besides ` getFullYear ` there's also ` getYear ` , which gives
428
+ you the year minus 1900 ( ` 98 ` or ` 119 ` ), and is mostly useless .
429
429
430
430
{{index "capture group", "getDate function"}}
431
431
@@ -434,11 +434,11 @@ interested in, we can now create a date object from a string.
434
434
435
435
```
436
436
function getDate(string) {
437
- let [_, day, month , year] =
437
+ let [_, month, day , year] =
438
438
/(\d{1,2})-(\d{1,2})-(\d{4})/.exec(string);
439
439
return new Date(year, month - 1, day);
440
440
}
441
- console.log(getDate("30-1 -2003"));
441
+ console.log(getDate("1-30 -2003"));
442
442
// → Thu Jan 30 2003 00:00:00 GMT+0100 (CET)
443
443
```
444
444
@@ -1036,8 +1036,9 @@ usually called an _INI_ file) are as follows:
1036
1036
- Anything else is invalid.
1037
1037
1038
1038
Our task is to convert a string like this into an object whose
1039
- properties hold strings for sectionless settings and sub-objects for
1040
- sections, with those sub-objects holding the section's settings.
1039
+ properties hold strings for settings written before the first
1040
+ section header and sub-objects for sections, with those sub-objects
1041
+ holding the section's settings.
1041
1042
1042
1043
{{index "carriage return", "line break", "newline character"}}
1043
1044
0 commit comments