Skip to content

Commit bca9d76

Browse files
authored
Correct example in 9.14 (Lookahead and lookbehind)
Without the `g` flag, we cannot say that the price is skipped. Without the `\b` assertion, we will have the `6` part of the price in the result.
1 parent 633db6f commit bca9d76

File tree

1 file changed

+1
-1
lines changed
  • 9-regular-expressions/14-regexp-lookahead-lookbehind

1 file changed

+1
-1
lines changed

9-regular-expressions/14-regexp-lookahead-lookbehind/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ The syntax is: `pattern:X(?!Y)`, it means "search `pattern:X`, but only if not f
5454
```js run
5555
let str = "2 turkeys cost 60€";
5656

57-
alert( str.match(/\d+(?!€)/) ); // 2 (the price is skipped)
57+
alert( str.match(/\d+\b(?!€)/g) ); // 2 (the price is not matched)
5858
```
5959

6060
## Lookbehind

0 commit comments

Comments
 (0)