Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Using named capturing groups:
- let re = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/;
- let result = re.exec('2017-04-24');
- // NOTE: need runtime support to access `groups`,
- // see `useRuntime` option:
- console.log(result.groups.year); // 2017
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement