const
reDate = /(?<year>[0-9]{4})-(?<month>[0-9]{2})-(?<day>[0-9]{2})/,
match = reDate.exec('2018-04-30'),
year = match.groups.year,
month = match.groups.month,
day = match.groups.day;
console.log(match);
console.log(year);
console.log(month);
console.log(day);
d = '2018-04-30',
usDate = d.replace(reDate, '$<month>-$<day>-$<year>');
console.log(usDate);
console.log('-----------------------------------------');
var str = 'From 2019.01.29 to 2019.01.30';
var allMatchs = str.matchAll(/(?<year>\d{4}).(?<month>\d{2}).(?<day>\d{2})/g);
for (const match1 of allMatchs) {
console.log(match1);
}
console