Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
how to verify that the email address column's data is having @ or [.] if not then load rejected data on diferent table.
please help!!
In the Repository, right click on Code, create a folder (here called "custom") then right click on "custom" and create a routine then past the code from my previous answer.
Here is what your screen should look like:
@vitspltalend, having an @ or a . (dot) is not enough to be a valid email.
The following "@@@@...." matches the rule but is not a valid email address.
As suggested by @shong, use a user defined routine to check the email validity.
It should look like this one:
package routines;
import java.util.regex.*;
public class checkEmail {
public static boolean isEmailValid(String email) {
String regex = "^[\\w!#$%&'*+/=?`{|}~^-]+(?:\\.[\\w!#$%&'*+/=?`{|}~^-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,6}$";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(email);
return matcher.matches();
}
}
That's a good shout by @TRF. As an addition to that (he should get the solution on this), Talend supplies the Apache Commons libraries which have hundreds of really useful, efficient and community (Java community) checked/built solutions. The Apache Commons Validator library comes with a whole host of validation methods for Emails, Phone Numbers, URLs, etc, etc. You should take a look.
In the Repository, right click on Code, create a folder (here called "custom") then right click on "custom" and create a routine then past the code from my previous answer.
Here is what your screen should look like:
This tutorial (https://help.talend.com/reader/jomWd_GKqAmTZviwG_oxHQ/O_Vnk3B4SbKXtF5gTQl2Gg) shows how to use the Advanced Mode (which is what you will need). To point to the routine, you will need to use something like this....
routines.YourRoutineClass.yourRoutineMethod(parameters)
Use tFilter Advanced mode to write the appropriate expression such as:
checkEmail.isEmailValid(row1.yourEmailField)