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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants