
Software Engineer @boltapp | Developer, Traveller | JavaScript, React, Node.js, Go | Prev @expert_lead @BigBinary @surveysparrow @QBurst
- Tweets788
- Following864
- Followers218
- Likes3.7K
![This feature is about identifying capture groups via names. // Without named capture groups const re = /(\d{4})-(\d{2})-(\d{2})/; const match = re.exec('2021-03-04'); console.log(match[1]); // β 2021 (year) console.log(match[2]); // β 03 (month) console.log(match[3]); // β 04 (day) // With named capture groups π₯ const re = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/; const match = re.exec('2021-03-04'); console.log(match.groups.year); // β 2021 console.log(match.groups.month); // β 03 console.log(match.groups.day); // β 04 // ... and with destructuring assignment π₯π₯π₯ const [match, year, month, day] = re.exec('2021-03-04');](https://pbs.twimg.com/media/EzwqDp7VgAAQQnZ.jpg?name=small&format=webp)
ALT This feature is about identifying capture groups via names. // Without named capture groups const re = /(\d{4})-(\d{2})-(\d{2})/; const match = re.exec('2021-03-04'); console.log(match[1]); // β 2021 (year) console.log(match[2]); // β 03 (month) console.log(match[3]); // β 04 (day) // With named capture groups π₯ const re = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/; const match = re.exec('2021-03-04'); console.log(match.groups.year); // β 2021 console.log(match.groups.month); // β 03 console.log(match.groups.day); // β 04 // ... and with destructuring assignment π₯π₯π₯ const [match, year, month, day] = re.exec('2021-03-04');








