Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 9-regular-expressions/11-regexp-groups/01-test-mac/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ alert( regexp.test('0132546789AB') ); // false (no colons)

alert( regexp.test('01:32:54:67:89') ); // false (5 numbers, must be 6)

alert( regexp.test('01:32:54:67:89:ZZ') ) // false (ZZ ad the end)
alert( regexp.test('01:32:54:67:89:ZZ') ) // false (ZZ at the end)
```
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
A positive number with an optional decimal part is (per previous task): `pattern:\d+(\.\d+)?`.
A positive number with an optional decimal part is: `pattern:\d+(\.\d+)?`.

Let's add the optional `pattern:-` in the beginning:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
A regexp for a number is: `pattern:-?\d+(\.\d+)?`. We created it in previous tasks.
A regexp for a number is: `pattern:-?\d+(\.\d+)?`. We created it in the previous task.

An operator is `pattern:[-+*/]`. The hyphen `pattern:-` goes first in the square brackets, because in the middle it would mean a character range, while we just want a character `-`.

Expand Down
2 changes: 1 addition & 1 deletion 9-regular-expressions/11-regexp-groups/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ The call to `matchAll` does not perform the search. Instead, it returns an itera

So, there will be found as many results as needed, not more.

E.g. there are potentially 100 matches in the text, but in a `for..of` loop we found 5 of them, then decided it's enough and make a `break`. Then the engine won't spend time finding other 95 matches.
E.g. there are potentially 100 matches in the text, but in a `for..of` loop we found 5 of them, then decided it's enough and made a `break`. Then the engine won't spend time finding other 95 matches.
```

## Named groups
Expand Down