Advertisement
didkoslawow

Untitled

Mar 20th, 2023
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function extractEmails(input) {
  2.    const mailValidation = /(^|(?<=\s))(([a-zA-Z0-9]+)([\.\-_]?)([A-Za-z0-9]+)(@)([a-zA-Z]+([\.\-][A-Za-z]+)+))(\b|(?=\s))/gmi
  3.    let matches = mailValidation.exec(input);
  4.  
  5.    while (matches !== null) {
  6.      console.log(matches[0]);
  7.      matches = mailValidation.exec(input);
  8.    }
  9.  }
  10.  
  11.  extractEmails(
  12.    'Many users @ SoftUni confuse email addresses. We @ Softuni.BG provide high-quality training @ home or @ class. –- steve.parker@soft-uni.de.'
  13.  );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement