File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
11-regexp-groups/01-test-mac Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ let str = `1st place: Winnie
16163rd place: Eeyore` ;
1717
1818* ! *
19- alert ( str .match (/ ^ \d / gm ) ); // 1, 2, 3
19+ console . log ( str .match (/ ^ \d / gm ) ); // 1, 2, 3
2020*/ ! *
2121```
2222
@@ -28,7 +28,7 @@ let str = `1st place: Winnie
28283rd place: Eeyore` ;
2929
3030* ! *
31- alert ( str .match (/ ^ \d / g ) ); // 1
31+ console . log ( str .match (/ ^ \d / g ) ); // 1
3232*/ ! *
3333```
3434
@@ -51,7 +51,7 @@ let str = `Winnie: 1
5151Piglet: 2
5252Eeyore: 3` ;
5353
54- alert ( str .match (/ \d $ / gm ) ); // 1,2,3
54+ console . log ( str .match (/ \d $ / gm ) ); // 1,2,3
5555```
5656
5757Without the flag ` pattern:m ` , the dollar ` pattern:$ ` would only match the end of the whole text, so only the very last digit would be found.
@@ -75,7 +75,7 @@ let str = `Winnie: 1
7575Piglet: 2
7676Eeyore: 3` ;
7777
78- alert ( str .match (/ \d\n / gm ) ); // 1\n,2\n
78+ console . log ( str .match (/ \d\n / gm ) ); // 1\n,2\n
7979```
8080
8181As we can see, there are 2 matches instead of 3.
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ Now let's show that the match should capture all the text: start at the beginnin
99Finally:
1010
1111``` js run
12- let regexp = / ^ [0-9a-fA-F ] {2} (:[0-9a-fA-F ] {2} ){5} $ / i ;
12+ let regexp = / ^ [0-9a-f ] {2} (:[0-9a-f ] {2} ){5} $ / i ;
1313
1414alert ( regexp .test (' 01:32:54:67:89:AB' ) ); // true
1515
You can’t perform that action at this time.
0 commit comments