Global matchAll in JavaScript regexes

The matchAll method returns all matches as an iterable object, each element of which contains an array of the match and its capturing groups. The method can only be called with the g modifier.

Let's look at an example. Let's say we have the following string:

javascriptlet str = '12 34 56';

We find all pairs of numbers and split their numbers into capturing groups:

javascriptlet matches = str.matchAll(/(\d)(\d)/g);

Let's go through the resulting iterable in a loop and display the found matches:

javascriptfor (let match of matches) {
  console.log(match); // [12, 1, 2], [34, 3, 4], [56, 5, 6] 
}
Задание 1

Given the following string:

javascriptlet str = '12:37 15:48 17:59';

Find in it all substrings with the time and for each found put the hours and minutes into capturing groups.

Задание 2

Given a string:

javascriptlet str = 'site.ru sss site.com zzz site.net';

Get an array of domain names from this string, put the domain name and its zone in different capturing groups in this array.