Advertisement
kristina111

Untitled

Oct 31st, 2016
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function extractEmails(input) {
  2.     let text = input[0];
  3.     const pattern = /(?:^| )([a-z][a-z0-9\-\._]+@[a-z0-9\-]+(\.[a-z0-9\-]+){1,})/g;
  4.     //let match = pattern.exec(text);
  5.     let matches = text.match(pattern);
  6.     if(matches!=null){
  7.         for(let m of matches){
  8.             console.log(m.trim());
  9.         }
  10.     }
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement