-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #421 from MrsMelnychenko/regex-sets
Sets and ranges [...]
- Loading branch information
Showing
9 changed files
with
118 additions
and
118 deletions.
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
...ular-expressions/08-regexp-character-sets-and-ranges/1-find-range-1/solution.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
9-regular-expressions/08-regexp-character-sets-and-ranges/1-find-range-1/task.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Java[^script] | ||
|
||
We have a regexp `pattern:/Java[^script]/`. | ||
У нас є регулярний вираз `pattern:/Java[^script]/`. | ||
|
||
Does it match anything in the string `subject:Java`? In the string `subject:JavaScript`? | ||
Чи знайде він співпадіння у рядку `subject:Java`? А у рядку `subject:JavaScript`? |
6 changes: 3 additions & 3 deletions
6
...pressions/08-regexp-character-sets-and-ranges/2-find-time-2-formats/solution.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
Answer: `pattern:\d\d[-:]\d\d`. | ||
Відповідь: `pattern:\d\d[-:]\d\d`. | ||
|
||
```js run | ||
let regexp = /\d\d[-:]\d\d/g; | ||
alert( "Breakfast at 09:00. Dinner at 21-30".match(regexp) ); // 09:00, 21-30 | ||
alert( "Сніданок о 09:00. Вечеря о 21-30".match(regexp) ); // 09:00, 21-30 | ||
``` | ||
|
||
Please note that the dash `pattern:'-'` has a special meaning in square brackets, but only between other characters, not when it's in the beginning or at the end, so we don't need to escape it. | ||
Зверніть увагу, що риска `pattern:'-'` має спеціальне значення у квадратних дужках але тільки між іншими символами, не на початку чи в кінці виразу, тож немає необхідності її екранувати. |
10 changes: 5 additions & 5 deletions
10
...r-expressions/08-regexp-character-sets-and-ranges/2-find-time-2-formats/task.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
# Find the time as hh:mm or hh-mm | ||
# Знайдіть часовий формат hh:mm або hh-mm | ||
|
||
The time can be in the format `hours:minutes` or `hours-minutes`. Both hours and minutes have 2 digits: `09:00` or `21-30`. | ||
Час можна записати у форматі `години:хвилини` або `години-хвилини`. У будь-якому разі потрібні дві цифри для позначення годин і хвилин: `09:00` або `21-30`. | ||
|
||
Write a regexp to find time: | ||
Напишіть регулярний вираз для пошуку часового формату: | ||
|
||
```js | ||
let regexp = /your regexp/g; | ||
alert( "Breakfast at 09:00. Dinner at 21-30".match(regexp) ); // 09:00, 21-30 | ||
alert( "Сніданок о 09:00. Вечеря о 21-30".match(regexp) ); // 09:00, 21-30 | ||
``` | ||
|
||
P.S. In this task we assume that the time is always correct, there's no need to filter out bad strings like "45:67". Later we'll deal with that too. | ||
P.S. В цій задачі ми завжди маємо коректний час, не потрібно перевіряти неіснуючі комбінації цифр, як-то "45:67". Пізніше ми роглянемо і такі випадки. |
170 changes: 85 additions & 85 deletions
170
9-regular-expressions/08-regexp-character-sets-and-ranges/article.md
Large diffs are not rendered by default.
Oops, something went wrong.
6 changes: 3 additions & 3 deletions
6
9-regular-expressions/09-regexp-quantifiers/1-find-text-manydots/solution.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
|
||
Solution: | ||
Відповідь: | ||
|
||
```js run | ||
let regexp = /\.{3,}/g; | ||
alert( "Hello!... How goes?.....".match(regexp) ); // ..., ..... | ||
alert( "Привіт!... Як справи?.....".match(regexp) ); // ..., ..... | ||
``` | ||
|
||
Please note that the dot is a special character, so we have to escape it and insert as `\.`. | ||
Зауважте, що крапка це спецсимвол, тож потребує екранування за допомогою `\.`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
9-regular-expressions/09-regexp-quantifiers/2-find-html-colors-6hex/task.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
# Regexp for HTML colors | ||
# Регулярний вираз для кольорів в HTML | ||
|
||
Create a regexp to search HTML-colors written as `#ABCDEF`: first `#` and then 6 hexadecimal characters. | ||
Створіть регулярний вираз, який шукає HTML-кольори записані у форматі `#ABCDEF`: спершу символ `#` за яким слідують 6 шістнадцяткових символів. | ||
|
||
An example of use: | ||
Приклад використання: | ||
|
||
```js | ||
let regexp = /...your regexp.../ | ||
let regexp = /...ваш регулярний вираз.../ | ||
|
||
let str = "color:#121212; background-color:#AA00ef bad-colors:f#fddee #fd2 #12345678"; | ||
|
||
alert( str.match(regexp) ) // #121212,#AA00ef | ||
``` | ||
|
||
P.S. In this task we do not need other color formats like `#123` or `rgb(1,2,3)` etc. | ||
P.S. В цій задачі нам не потрібно враховувати інші формати запису кольорів, як наприклад `#123` або `rgb(1,2,3)` тощо. |