Skip to content

Methods of RegExp and String - #445

Merged
tarasyyyk merged 2 commits into
javascript-tutorial:masterfrom
SamGreenberg:methods-of-regexp-and-string
May 24, 2023
Merged

Methods of RegExp and String#445
tarasyyyk merged 2 commits into
javascript-tutorial:masterfrom
SamGreenberg:methods-of-regexp-and-string

Conversation

@SamGreenberg

Copy link
Copy Markdown
Contributor

No description provided.

````warn header="Same global regexp tested repeatedly on different sources may fail"
If we apply the same global regexp to different inputs, it may lead to wrong result, because `regexp.test` call advances `regexp.lastIndex` property, so the search in another string may start from non-zero position.
````warn header="Один і той самий глобальний регулярний вираз, протестований багато разів на різних даних, може помилятись"
Якщо ми застосуємо один і той самий глобальний регулярний вираз до різних вхідних даних, можемо отримати неправильні результати, бо виклик `regexp.test` посуває властивість `regexp.lastIndex`, тож пошук в іншому рядку може початись з позиції, відмінною від нуля.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"відмінної"? позиції якої? - "відмінної"

@tarasyyyk
tarasyyyk merged commit 67130e0 into javascript-tutorial:master May 24, 2023
@javascript-translate-bot

Copy link
Copy Markdown
Contributor

Thank you 💖 I updated the Progress Issue #1 🎉 🎉 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4 participants