Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(input){
  2.     let dates = input;
  3. let pattern = /(?<day>\d{2})([-.\/])(?<month>[A-Z][a-z]{2})\2(?<year>\d{4})/g;
  4.  
  5. while((validDt = pattern.exec(dates))!==null){
  6. let days = validDt.groups['day'];
  7. let months =  validDt.groups['month'];
  8. let years = validDt.groups['year'];
  9. console.log(`Day: ${days}, Month: ${months}, Year: ${years}`);
  10. }
  11.  
  12.  
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement