Skip to content

Greedy and lazy quantifiers #450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

SamGreenberg
Copy link
Contributor

No description provided.

@SamGreenberg SamGreenberg marked this pull request as draft January 26, 2023 20:46
@dolgachio dolgachio self-requested a review June 5, 2023 10:37
@dolgachio dolgachio added the in progress Translation in progress label Jun 5, 2023
@dolgachio
Copy link
Collaborator

@SamGreenberg Підкажіть будь ласка, чи актуальний статус Draft для цього пулл реквеста?

@dolgachio dolgachio removed the in progress Translation in progress label Aug 7, 2023
@SamGreenberg SamGreenberg marked this pull request as ready for review August 14, 2023 14:38
@SamGreenberg SamGreenberg changed the title Draft: Greedy and lazy quantifiers Greedy and lazy quantifiers Aug 14, 2023
@SamGreenberg
Copy link
Contributor Author

@stas-dolgachov draft більше не актуальний

Copy link
Collaborator

@dolgachio dolgachio left a comment

Choose a reason for hiding this comment

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

Дякую, за чудовий переклад! Я зараз зроблю кілька невеличких правок і прийму його


As we've seen, the lazy mode is not a "panacea" from the greedy search. An alternative is a "fine-tuned" greedy search, with exclusions, as in the pattern `pattern:"[^"]+"`.
Як бачимо, лінивий режим не є "панацеєю" від жадібного пошуку. Як альтернативу розглядають "добре налаштований" жадібний пошук, з виключенням, як в патерні `pattern:"[^"]+"`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Як бачимо, лінивий режим не є "панацеєю" від жадібного пошуку. Як альтернативу розглядають "добре налаштований" жадібний пошук, з виключенням, як в патерні `pattern:"[^"]+"`.
Як бачимо, лінивий режим не є "панацеєю" від жадібного пошуку. Як альтернативу розглядають "добре налаштований" жадібний пошук, з виключенням, як в шаблоні `pattern:"[^"]+"`.

2. Then it looks for `pattern:.*?`: takes one character (lazily!), check if there's a match for `pattern:" class="doc">` (none).
3. Then takes another character into `pattern:.*?`, and so on... until it finally reaches `match:" class="doc">`.
1. Спочатку, регулярний вираз знаходить початок посилання `match:<a href="`.
2. Далі, він шукає `pattern:.*?`: бере один символ (ліниво!), перевіряє наявність збігу для `pattern:" class="doc">` (нема).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
2. Далі, він шукає `pattern:.*?`: бере один символ (ліниво!), перевіряє наявність збігу для `pattern:" class="doc">` (нема).
2. Далі, він шукає `pattern:.*?`: бере один символ (ліниво!), перевіряє наявність збігу для `pattern:" class="doc">` (немає).

Lazy
: Enabled by the question mark `pattern:?` after the quantifier. The regexp engine tries to match the rest of the pattern before each repetition of the quantified character.
Лінивий
: Включається знаком питання `pattern:?` після квантифікатору. Рушій намагається знайти збіг решти патерну перед кожним повторенням квантифікованого символу.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
: Включається знаком питання `pattern:?` після квантифікатору. Рушій намагається знайти збіг решти патерну перед кожним повторенням квантифікованого символу.
: Включається знаком питання `pattern:?` після квантифікатору. Рушій намагається знайти збіг решти шаблону перед кожним повторенням квантифікованого символу.

@dolgachio dolgachio merged commit 50370dd into javascript-tutorial:master Aug 22, 2023
@javascript-translate-bot
Copy link
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.

3 participants