Page 1 of 1

Validating E-mail

Posted: Mon Jan 10, 2005 2:00 pm
by yaminids
Hello all,

Can anybody provide me a routine to validate e-mail address. I want to check the following condition to validate e-mail(xxxx@xxx.xxx).

Thanx in advance.
-Yamini

Posted: Mon Jan 10, 2005 2:49 pm
by ArndW
I would use the pattern matching of DataStage BASIC for a rough filter of valid e-mail addresses. I would use the MATCHES function and the pattern you might use is "0X'@'0X'.com'" or "0X'@'0X'.'3X" if all of the expected addresses are to ".com"s or 3-digit suffixes. If this isn't sufficient then at least you have somewhere to start .

Posted: Mon Jan 10, 2005 3:09 pm
by ray.wurlod
Beware, though, that not all email addresses have a three digit suffix. We've had .co.uk (and other countries) since day 1, and now .info and .name (and .tv and the like) are becoming more popular.

If you need to use the MATCHES operator against a list of possibilities, there's a cute trick using a multi-valued list of match patterns. For example:

Code: Select all

Email.Address MATCHES "0X'@'0X'.'3A" : @VM : "0X'@'0X'.'2A'" : @VM : "0X'@'0X'.'4A'"
Put the most likely candidate at the head of the list and the least likely candidate at the end of the list.

Validating E-mail

Posted: Mon Jan 10, 2005 3:51 pm
by yaminids
Hello all,
Thank you very much for ur help.
-Yamini

Validating E-mail

Posted: Fri Apr 08, 2005 3:48 pm
by yaminids
Hello Ray,

I know its too long to ask a question regarding this posting but I have a small problem in implementing the logic. When I am trying to validate an e-mail your condition is working fine for all conditions except when the email-id is in the following format:

abcdef@yahoo.

Can you help me in re-coding the Mathces statement?

Thank you very much in advance.
-Yamini

Posted: Sat Apr 09, 2005 4:37 pm
by ray.wurlod
Is that really a valid email address??

Code: Select all

Upcase(Email.Address) MATCHES "0X'@'0X'.'3A" : @VM : "0X'@'0X'.'2A'" : @VM : "0X'@'0X'.'4A'" : @VM : "0X'@YAHOO.'"
would handle just the yahoo case in a non-case-sensitive manner. I suspect you don't want to handle all possible string@string. addresses since most of these will be erroneous.