zerolab-fe / one-question-per-day

每天一个小问题
21 stars 7 forks source link

正则表达式命名捕获组 #138

Open GleanCoder1116 opened 3 years ago

GleanCoder1116 commented 3 years ago
const reg = /(?<year>[0-9]{4})-(?<month>[0-9]{2})-(?<day>[0-9]{2})/;
const match = reg.exec('2021-02-23');

image