Named capturing groups in JavaScript regular expression let you assign easy to read names to the group. You can then use this name to look up the text the group matches
To name a capturing group, after the opening parenthesis of the group just add a ? followed by the name group surrounded buy angle brackets. Then on the match result, you can access the matched text using: match.groups.yourCapturingGroupName
This makes your regular expressions more resilient because extracting matches won't depend on the order or number of capturing groups. It also makes the code much easier to read because it is easy to tell which group is being accessed
https://developer.mozilla.org/en-US/d...
Watch video JavaScript Tips — Named capturing groups in regular expressions online, duration hours minute second in high quality that is uploaded to the channel Code 2020 21 November 2022. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 2,901 times and liked it 35 visitors.