minor fixes
This commit is contained in:
parent
cc18823108
commit
be69f349d0
2 changed files with 5 additions and 5 deletions
|
@ -16,7 +16,7 @@ let str = `1st place: Winnie
|
||||||
3rd place: Eeyore`;
|
3rd place: Eeyore`;
|
||||||
|
|
||||||
*!*
|
*!*
|
||||||
alert( str.match(/^\d/gm) ); // 1, 2, 3
|
console.log( str.match(/^\d/gm) ); // 1, 2, 3
|
||||||
*/!*
|
*/!*
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ let str = `1st place: Winnie
|
||||||
3rd place: Eeyore`;
|
3rd place: Eeyore`;
|
||||||
|
|
||||||
*!*
|
*!*
|
||||||
alert( str.match(/^\d/g) ); // 1
|
console.log( str.match(/^\d/g) ); // 1
|
||||||
*/!*
|
*/!*
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ let str = `Winnie: 1
|
||||||
Piglet: 2
|
Piglet: 2
|
||||||
Eeyore: 3`;
|
Eeyore: 3`;
|
||||||
|
|
||||||
alert( str.match(/\d$/gm) ); // 1,2,3
|
console.log( str.match(/\d$/gm) ); // 1,2,3
|
||||||
```
|
```
|
||||||
|
|
||||||
Without 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.
|
Without 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
|
||||||
Piglet: 2
|
Piglet: 2
|
||||||
Eeyore: 3`;
|
Eeyore: 3`;
|
||||||
|
|
||||||
alert( str.match(/\d\n/gm) ); // 1\n,2\n
|
console.log( str.match(/\d\n/gm) ); // 1\n,2\n
|
||||||
```
|
```
|
||||||
|
|
||||||
As we can see, there are 2 matches instead of 3.
|
As we can see, there are 2 matches instead of 3.
|
||||||
|
|
|
@ -9,7 +9,7 @@ Now let's show that the match should capture all the text: start at the beginnin
|
||||||
Finally:
|
Finally:
|
||||||
|
|
||||||
```js run
|
```js run
|
||||||
let regexp = /^[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}$/i;
|
let regexp = /^[0-9a-f]{2}(:[0-9a-f]{2}){5}$/i;
|
||||||
|
|
||||||
alert( regexp.test('01:32:54:67:89:AB') ); // true
|
alert( regexp.test('01:32:54:67:89:AB') ); // true
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue