reg->regexp
This commit is contained in:
parent
4232a53219
commit
32e20fc97c
35 changed files with 132 additions and 132 deletions
|
@ -3,9 +3,9 @@ A positive number with an optional decimal part is (per previous task): `pattern
|
|||
Let's add the optional `pattern:-` in the beginning:
|
||||
|
||||
```js run
|
||||
let reg = /-?\d+(\.\d+)?/g;
|
||||
let regexp = /-?\d+(\.\d+)?/g;
|
||||
|
||||
let str = "-1.5 0 2 -123.4.";
|
||||
|
||||
alert( str.match(reg) ); // -1.5, 0, 2, -123.4
|
||||
alert( str.match(regexp) ); // -1.5, 0, 2, -123.4
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue