Filtering periods out of email addresses with regex

I need to clean a set of gmail addresses that are functionally equivalent using a regex. You may know of the gmail hack where "brunette.thomas@gmail" is treated by gmail as "brunetteandrew@gmail". People are entering multiple entries in a sweepstakes by adding periods to their email address.

I need to filter these down to just the alpha component of the email address, ie., turn:

brunettethomas@gmail.com

into:

brunettethomas@gmail.com

regardless of the number of periods.

Can anyone help me with this?


You can use this to match all periods before the at-sign:

.(?=.*@)

Then you can just globally replace it with null-string. This will only work on regexp dialects that support lookahead (you haven't stated which dialect you're using).

链接地址: http://www.djcxy.com/p/92776.html

上一篇: 避免使用同一电子邮件的多个帐户

下一篇: 使用正则表达式过滤电子邮件地址