- Notifications
You must be signed in to change notification settings - Fork179
Alternation (OR) |#388
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
CLAassistant commentedSep 17, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
Дякую, за чудовий переклад! Вибачаюсь, що вам довелося так довго чекати :)
Подивіться, будь ласка, мої коментарі і напишіть мені, якщо з чимось не згодні.
Alternation is the term in regular expression that is actually a simple "OR". | ||
Альтернація - це термін у регулярному виразі, який насправді є простим "АБО". |
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:gr(a|e)y` means exactly the same as `pattern:gr[ae]y`. | ||
- `pattern:gra|ey` means `match:gra` or `match:ey`. | ||
- `pattern:gr(a|e)y` означає те саме, що і `pattern:gr[ae]y`. |
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:gr(a|e)y` означає те саме, щоі`pattern:gr[ae]y`. | |
-`pattern:gr(a|e)y` означає те саме, щой`pattern:gr[ae]y`. |
To apply alternation to a chosen part of the pattern, we can enclose it in parentheses: | ||
- `pattern:I love HTML|CSS` matches `match:I love HTML` or `match:CSS`. | ||
- `pattern:I love (HTML|CSS)` matches `match:I love HTML` or `match:I love CSS`. | ||
Для того, щоб використати альтернацію до обраної частини шаблону, ми можемо загорнути його у дужки: |
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.
Для того, щоб використати альтернаціюдо обраної частини шаблону, ми можемо загорнути його у дужки: | |
Для того, щоб використати альтернаціюз обраною частиною шаблону, ми можемо загорнути його у дужки: |
In previous articles there was a task to build a regexp for searching time in the form `hh:mm`,for instance`12:00`.But a simple `pattern:\d\d:\d\d`is too vague. It accepts `25:99`as the time (as99minutes match the pattern, but that time is invalid). | ||
У попередніх главах було завдання написати регулярний вираз для пошуку часу у форматі `гг:хх`,наприклад`12:00`.Однак простий шаблон `pattern:\d\d:\d\d`недостатньо точний. Він приймає `25:99`як час (99хвилин підходять до шаблону, однак цей час не є вірним). |
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.
У попередніхглавах було завдання написати регулярний вираз для пошуку часу у форматі`гг:хх`, наприклад`12:00`. Однак простий шаблон`pattern:\d\d:\d\d` недостатньо точний. Він приймає`25:99` як час (99 хвилин підходять до шаблону, однак цей час не є вірним). | |
У попередніхстаттях було завдання написати регулярний вираз для пошуку часу у форматі`гг:хх`, наприклад`12:00`. Однак простий шаблон`pattern:\d\d:\d\d` недостатньо точний. Він приймає`25:99` як час (99 хвилин підходять до шаблону, однак цей час не є вірним). |
- (no other first digit is allowed) | ||
-Якщо перша цифра`0`або `1`,тоді наступна може бути будь-якою цифрою: `pattern:[01]\d`. | ||
-В іншому випадку, якщо перша цифра `2`,тоді наступна має бути від 0 до 3 `pattern:[0-3]`. | ||
- (іншої першої цифри не може бути) |
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.
- (іншої першої цифри не може бути) | |
- (іншої першої цифрибутине може) |
```js | ||
let regexp = /your regexp/flags; | ||
let regexp = /ваш регулярний вираз/прапорець; |
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.
let regexp = /ваш регулярний вираз/прапорець; | |
let regexp = /ваш регулярний вираз/прапорці; |
let str = "..[url]http://google.com[/url].."; | ||
alert( str.match(regexp) ); // [url]http://google.com[/url] | ||
``` | ||
If tags are nested, then we need the outer tag (if we want we can continue the search in its content): | ||
Якщо теки вкладені, тоді необхідно шукати зовнішній тег (за бажанням, можна продовжити пошук всередині його вмісту): |
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.
Якщотеки вкладені, тоді необхідно шукати зовнішній тег (за бажанням, можна продовжити пошук всередині його вмісту): | |
Якщотеги вкладені, тоді необхідно шукати зовнішній тег (за бажанням, можна продовжити пошук всередині його вмісту): |
```js | ||
let regexp = /your regexp/flags; | ||
let regexp = /ваш регулярний вираз/прапорець; |
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.
let regexp = /ваш регулярний вираз/прапорець; | |
let regexp = /ваш регулярний вираз/прапорці; |
@@ -1,17 +1,17 @@ | |||
The solution: `pattern:/"(\\.|[^"\\])*"/g`. | |||
Вирішення: `pattern:/"(\\.|[^"\\])*"/g`. |
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:/"(\\.|[^"\\])*"/g`. | |
Рішення:`pattern:/"(\\.|[^"\\])*"/g`. |
That's the essential part of the task, otherwise it would be trivial. | ||
У цьому і полягає основна складність завдання, адже без цієї умови - вирішення було б елементарним. |
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.
У цьому і полягає основна складність завдання, адже без цієї умови - вирішення було б елементарним. | |
У цьому і полягає основна складність завдання, адже без цієї умови -- рішення було б елементарним. |
Please make the requested changes. After it, add a comment "/done". |
/done |
Дякую за можливість зробити внесок у розвиток чудового ресурсу для україномовної спільноти. Згідний з усіма правками.) |
@all-contributors add@vladiuskor for translation |
@stas-dolgachov I've put upa pull request to add@vladiuskor! 🎉 |
No description provided.