开发者

Email list problem

My sql query to get all the e-mail addresses from my table is as follows:

SELECT DISTINCT cEmail
  FROM tblUsers
  WHERE cEmail I开发者_StackOverflowS NOT NULL AND
        cEmail LIKE '%_@__%.__%'

However, when I insert the list to gmail, it's still saying there are invalid e-mails. There are over 2000 e-mails and hard to go through each one to find out the problem.

Anyway to improve my query?


You may check using regulars expressions with MySQL unsing the REGEXP operator See : http://dev.mysql.com/doc/refman/5.0/en/regexp.html#operator_regexp

And find / adapt a decent email checking regular expression (Google "regexp email") Example : \b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b found here : http://www.regular-expressions.info/regexbuddy/email.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜