reg->regexp
This commit is contained in:
parent
4232a53219
commit
32e20fc97c
35 changed files with 132 additions and 132 deletions
|
@ -8,13 +8,13 @@ Write a regexp that checks whether a string is MAC-address.
|
|||
|
||||
Usage:
|
||||
```js
|
||||
let reg = /your regexp/;
|
||||
let regexp = /your regexp/;
|
||||
|
||||
alert( reg.test('01:32:54:67:89:AB') ); // true
|
||||
alert( regexp.test('01:32:54:67:89:AB') ); // true
|
||||
|
||||
alert( reg.test('0132546789AB') ); // false (no colons)
|
||||
alert( regexp.test('0132546789AB') ); // false (no colons)
|
||||
|
||||
alert( reg.test('01:32:54:67:89') ); // false (5 numbers, must be 6)
|
||||
alert( regexp.test('01:32:54:67:89') ); // false (5 numbers, must be 6)
|
||||
|
||||
alert( reg.test('01:32:54:67:89:ZZ') ) // false (ZZ ad the end)
|
||||
alert( regexp.test('01:32:54:67:89:ZZ') ) // false (ZZ ad the end)
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue