reg->regexp

This commit is contained in:
Ilya Kantor 2019-09-06 16:50:41 +03:00
parent 4232a53219
commit 32e20fc97c
35 changed files with 132 additions and 132 deletions

View file

@ -96,18 +96,18 @@ In the example below the currency sign `pattern:(€|kr)` is captured, along wit
```js run
let str = "1 turkey costs 30€";
let reg = /\d+(?=(€|kr))/; // extra parentheses around €|kr
let regexp = /\d+(?=(€|kr))/; // extra parentheses around €|kr
alert( str.match(reg) ); // 30, €
alert( str.match(regexp) ); // 30, €
```
And here's the same for lookbehind:
```js run
let str = "1 turkey costs $30";
let reg = /(?<=(\$|£))\d+/;
let regexp = /(?<=(\$|£))\d+/;
alert( str.match(reg) ); // 30, $
alert( str.match(regexp) ); // 30, $
```
## Summary