Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function matchDates(arr){
- let pattern = /(?<day>\d{2})([\/.-])(?<month>[A-Z][a-z]{2})\2(?<year>\d{4})/g;
- let validDates = []; //arr[0].match(pattern);
- let text = arr[0];
- // let test = pattern.test(text);
- // console.log(test) //false
- while((validDates = pattern.exec(text)) !== null){
- let day = validDates.groups['day'];
- let month = validDates.groups['month'];
- let year = validDates.groups['year'];
- console.log(`Day: ${day}, Month: ${month}, Year: ${year}`);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement