-->

Friday 13 February 2009

Email spelling check with Kettle !

Hi all,

Today, I had to check email spelling across some very large files before loading into database.
Kettle helped me here, with some javascript, regular expression and a conditional branch to route the good and bad emails.
Below is the transformation :

And the javascript code ....

//Javascript with regular expressions to test email spelling

// Code by Vincent Teyssier

var email_string = email.getString();

var pattern=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

if(pattern.test(email_string))

{

var Emails_status = "good";

}

else

{

var Emails_status = "bad";

}

No comments: