1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-24 18:32:22 +00:00

docs(regex): fix 具名组匹配

This commit is contained in:
ruanyf 2018-10-18 19:59:33 +08:00
parent bad0552112
commit 6301c90a99

View File

@ -550,7 +550,7 @@ let re = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/u;
S, // 原字符串 2015-01-02
groups // 具名组构成的一个对象 {year, month, day}
) => {
let {day, month, year} = args[args.length - 1];
let {day, month, year} = groups;
return `${day}/${month}/${year}`;
});
```