Skip to content

Commit 21b19dc

Browse files
authored
Merge pull request #2261 from wam/change-var-to-let-in-regexp-sticky-section
Change `var` to `let` in 7.16 regexp-sticky
2 parents fe9635b + e09706a commit 21b19dc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

16-regexp-sticky/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ E.g. we have a code string `subject:let varName = "value"`, and we need to read
1313

1414
We'll look for variable name using regexp `pattern:\w+`. Actually, JavaScript variable names need a bit more complex regexp for accurate matching, but here it doesn't matter.
1515

16-
- A call to `str.match(/\w+/)` will find only the first word in the line (`var`). That's not it.
16+
- A call to `str.match(/\w+/)` will find only the first word in the line (`let`). That's not it.
1717
- We can add the flag `pattern:g`. But then the call `str.match(/\w+/g)` will look for all words in the text, while we need one word at position `4`. Again, not what we need.
1818

1919
**So, how to search for a regexp exactly at the given position?**

0 commit comments

Comments
 (0)