Email Parser

[Total: 0    Average: 0/5]

This shows how to have javascript parse data to find email addresses.

Body Code:

<SCRIPT LANGUAGE="JavaScript"> 
<!-- Begin 
function findEmailAddresses(StrObj) { 
var separateEmailsBy = ", "; 
var email = "<none>"; // if no match, use this 
var emailsArray = StrObj.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+.[a-zA-Z0-9._-]+)/gi); 
if (emailsArray) { 
email = ""; 
for (var i = 0; i < emailsArray.length; i++) { 
if (i != 0) email += separateEmailsBy; 
email += emailsArray[i]; 
      } 
  } 
return email; 
} 
//  End --> 
</script> 
<center> 
<form> 
Enter into the text area some email addresses - when you click outside of the textarea
any email addresses entered will be put into the text box below (delinated by commas)
<BR>
<textarea name=comments rows=10 cols=50 onBlur="this.form.email.value=findEmailAddresses(this.value);"></textarea> 
<br> 
Email:  <input type=text name=email> 
</form> 
</center> 

Times Viewed: 2

Leave a Reply

Your email address will not be published. Required fields are marked *