- Notifications
You must be signed in to change notification settings - Fork179
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Greedy and lazy quantifiers#450
Uh oh!
There was an error while loading.Please reload this page.
Conversation
@SamGreenberg Підкажіть будь ласка, чи актуальний статус |
@stas-dolgachov draft більше не актуальний |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Дякую, за чудовий переклад! Я зараз зроблю кілька невеличких правок і прийму його
9-regular-expressions/10-regexp-greedy-and-lazy/1-lazy-greedy/solution.md OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
9-regular-expressions/10-regexp-greedy-and-lazy/3-find-html-comments/solution.md OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
9-regular-expressions/10-regexp-greedy-and-lazy/3-find-html-comments/solution.md OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
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:"[^"]+"`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Як бачимо, лінивий режим не є "панацеєю" від жадібного пошуку. Як альтернативу розглядають "добре налаштований" жадібний пошук, з виключенням, як впатерні`pattern:"[^"]+"`. | |
Як бачимо, лінивий режим не є "панацеєю" від жадібного пошуку. Як альтернативу розглядають "добре налаштований" жадібний пошук, з виключенням, як вшаблоні`pattern:"[^"]+"`. |
Uh oh!
There was an error while loading.Please reload this page.
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">` (нема). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
2. Далі, він шукає`pattern:.*?`: бере один символ (ліниво!), перевіряє наявність збігу для`pattern:">` (нема). | |
2. Далі, він шукає`pattern:.*?`: бере один символ (ліниво!), перевіряє наявність збігу для`pattern:">` (немає). |
Uh oh!
There was an error while loading.Please reload this page.
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:?`після квантифікатору. Рушій намагається знайти збіг решти патерну перед кожним повторенням квантифікованого символу. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
: Включається знаком питання`pattern:?` після квантифікатору. Рушій намагається знайти збіг рештипатерну перед кожним повторенням квантифікованого символу. | |
: Включається знаком питання`pattern:?` після квантифікатору. Рушій намагається знайти збіг рештишаблону перед кожним повторенням квантифікованого символу. |
Thank you 💖 I updated the Progress Issue#1 🎉 🎉 🎉 |
No description provided.