Skip to content

Commit 73d9d16

Browse files
authored
Update article.md
1 parent a7b707f commit 73d9d16

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

9-regular-expressions/09-regexp-groups/article.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ alert("my@mail.com @ his@site.com.uk".match(reg)); // my@mail.com, his@site.com.
4949

5050
Группы скобок нумируются слева направо. Поисковый движок запоминает содержимое в каждой группе и позволяет ссылаться на него в шаблоне регулярного выражения или строке для замены.
5151

52-
For instance, we'd like to find HTML tags `pattern:<.*?>`, and process them.
52+
Например, мы хотим найти HTML теги `pattern:<.*?>` и обрадотать их.
5353

54-
Let's wrap the inner content into parentheses, like this: `pattern:<(.*?)>`.
54+
Давайте заключим внутреннее содержимое в круглые скобки: `pattern:<(.*?)>`.
5555

56-
We'll get them into an array:
56+
Соберем их в массив:
5757

5858
```js run
5959
let str = '<h1>Hello, world!</h1>';
@@ -62,14 +62,14 @@ let reg = /<(.*?)>/;
6262
alert( str.match(reg) ); // Array: ["<h1>", "h1"]
6363
```
6464

65-
The call to [String#match](mdn:js/String/match) returns groups only if the regexp has no `pattern:/.../g` flag.
65+
Вызов [String#match](mdn:js/String/match) возвращает группы только если регулярное выражение не имеет флаг `pattern:/.../g`.
6666

67-
If we need all matches with their groups then we can use `.matchAll` or `regexp.exec` as described in <info:regexp-methods>:
67+
Если необходимы все совпадения с их группировкой, то мы можем использовать `.matchAll` или `regexp.exec` как описано в <info:regexp-methods>:
6868

6969
```js run
7070
let str = '<h1>Hello, world!</h1>';
7171

72-
// two matches: opening <h1> and closing </h1> tags
72+
// два совпадения: теги открытия <h1> и закрытия </h1>
7373
let reg = /<(.*?)>/g;
7474

7575
let matches = Array.from( str.matchAll(reg) );
@@ -78,7 +78,7 @@ alert(matches[0]); // Array: ["<h1>", "h1"]
7878
alert(matches[1]); // Array: ["</h1>", "/h1"]
7979
```
8080

81-
Here we have two matches for `pattern:<(.*?)>`, each of them is an array with the full match and groups.
81+
Здесь мы имеем два совпадения для `pattern:<(.*?)>`. Каждый из них является массивом с полным совдаением и группой.
8282

8383
## Nested groups
8484

0 commit comments

Comments
 (0)