Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function findDates(sentences) {
- let regex = new RegExp(/\b(\d{1,2}\-[A-Z][a-z]{2}\-\d{4})\b/, 'g');
- let validDates = [];
- for (let sentence of sentences) {
- let date = '';
- while (date = regex.exec(sentence)) {
- date = date[0].replace('-', ' ').replace('-', ' ');
- validDates.push(date);
- }
- }
- validDates.forEach(x => console.log(x));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement