Clear a full string if a "@" is missing

Hello,
I searched in the topics but without success.
I need to clean wrong email (@ is missing or no “.” for example).

 1) Is there a module for email testing ?
 2) How can i delete the full string if the @ is missing ? 

Example : blablaàgmail.com is not valid, i need to empty all the string.

Thank you very much for your help.

Konyl

Hi @Konyl,

there is nothing prebuilt in knime that does that. But we can use a Regular expression to filter emails that don’t fit the email scheme. I found an interesting regex pattern here. For these 5 emails only the selected ones remain (h.h@gmail.com, hh@gmail.com).

image

Here is a small example workflow demonstrating how it works. Let me know if that helped you.

Cheers,
Johannes

filter_emails.knwf (7.3 KB)

4 Likes

Hello Johannes,

Thank you very much for you answer.
I tried your WF it works fine (and i’ll sure use it on some other cases) but it clears the entire row, and i need to clear only the wrong email string and not the row, maybe i wasn’t clear, sorry for that.

Thank you again.

Konyl

Hi @Konyl,

You are welcome.
how is your data formatted then? Is it one row with a long string? How are the emails separated?

If you want to have the rows with invalid emails as empty cells, you can use the String Manipulation node and use a regexMatch function to determine which string is a valid email, then use a Rule Engine node to clear the strings that are not (I updated my workflow).
Cheers,
Johannes

P.S. I used this website to convert the regex to a java regex that can be used in the String Manipulation Node.

Updated workflow:
filter_emails.knwf (11.9 KB)

2 Likes

Works perfect !
Thanks again Johannes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.