Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
535
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. function solve(dates) {
  2.  
  3. let pattern = /\b(?<day>\d{2})([-.\/])(?<month>[A-Z][a-z]{2})\2(?<year>\d{4})\b/g;
  4. let validDate = [];
  5.  
  6.  
  7. while((validDate=pattern.exec(dates)) !== null) {
  8. let day = validDate.groups['day'];
  9. let month = validDate.groups['month'];
  10. let year = validDate.groups['year'];
  11. console.log(`Day: ${day}, Month: ${month}, Year: ${year}`);
  12. }
  13.  
  14. console.log(validPhones.join(', '));
  15.  
  16.  
  17. }
  18.  
  19. solve("13/Jul/1928, 10-Nov-1934, , 01/Jan-1951,f 25.Dec.1937 23/09/1973, 1/Feb/2016");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement