Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. // Using named capturing groups:
  2.  
  3. let re = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/;
  4.  
  5. let result = re.exec('2017-04-24');
  6.  
  7. // NOTE: need runtime support to access `groups`,
  8. // see `useRuntime` option:
  9.  
  10. console.log(result.groups.year); // 2017
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement