Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Email Validation in talend

 how to verify that the email address column's  data is having @ or [.] if not then load rejected data on diferent table.

please help!!

Labels (2)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

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:

0683p000009LxUe.png

 

View solution in original post

11 Replies
Anonymous
Not applicable
Author

Hi
Create a user routine and define the function to validate the email address, and call the user routine on tFilterRow to filter the valid email address. If you just want to simply check the email address if it is having @ or ., using this expression on tFilterRow:
input_row.emailColumn.contains("@")||input_row.emailColumn.contains(".")

Regards
Shong
TRF
Champion II
Champion II

@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();
    }
}
Anonymous
Not applicable
Author

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.

Anonymous
Not applicable
Author

thanks @shong and @TRF, actually i am new in talend so, can you please tell me the whole process like where i can create user defined routine and which component i can use?
TRF
Champion II
Champion II

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:

0683p000009LxUe.png

 

Anonymous
Not applicable
Author

hello shong can u plz tell me what is the process to call the user routine on tFilterrow to filter the valid email address?
Anonymous
Not applicable
Author

hello @TRF can u plz tell me what is the process to call the user routine on tFilterrow to filter the valid email address?
Anonymous
Not applicable
Author

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)

 

TRF
Champion II
Champion II

Use tFilter Advanced mode to write the appropriate expression such as:

checkEmail.isEmailValid(row1.yourEmailField)